/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
dhtmlx=function(obj){for (var a in obj)dhtmlx[a]=obj[a];return dhtmlx;};dhtmlx.extend_api=function(name,map,ext){var t = window[name];if (!t)return;window[name]=function(obj){if (obj && typeof obj == "object" && !obj.tagName){var that = t.apply(this,(map._init?map._init(obj):arguments));for (var a in dhtmlx)if (map[a])this[map[a]](dhtmlx[a]);for (var a in obj){if (map[a])this[map[a]](obj[a]);else if (a.indexOf("on")==0){this.attachEvent(a,obj[a]);}
 }
 }else
 var that = t.apply(this,arguments);if (map._patch)map._patch(this);return that||this;};window[name].prototype=t.prototype;if (ext)dhtmlXHeir(window[name].prototype,ext);};dhtmlxAjax={get:function(url,callback){var t=new dtmlXMLLoaderObject(true);t.async=(arguments.length<3);t.waitCall=callback;t.loadXML(url)
 return t;},
 post:function(url,post,callback){var t=new dtmlXMLLoaderObject(true);t.async=(arguments.length<4);t.waitCall=callback;t.loadXML(url,true,post)
 return t;},
 getSync:function(url){return this.get(url,null,true)
 },
 postSync:function(url,post){return this.post(url,post,null,true);}
}
function dtmlXMLLoaderObject(funcObject, dhtmlObject, async, rSeed){this.xmlDoc="";if (typeof (async)!= "undefined")
 this.async=async;else
 this.async=true;this.onloadAction=funcObject||null;this.mainObject=dhtmlObject||null;this.waitCall=null;this.rSeed=rSeed||false;return this;};dtmlXMLLoaderObject.count = 0;dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){var once = true;this.check=function (){if ((dhtmlObject)&&(dhtmlObject.onloadAction != null)){if ((!dhtmlObject.xmlDoc.readyState)||(dhtmlObject.xmlDoc.readyState == 4)){if (!once)return;once=false;dtmlXMLLoaderObject.count++;if (typeof dhtmlObject.onloadAction == "function")dhtmlObject.onloadAction(dhtmlObject.mainObject, null, null, null, dhtmlObject);if (dhtmlObject.waitCall){dhtmlObject.waitCall.call(this,dhtmlObject);dhtmlObject.waitCall=null;}
 }
 }
 };return this.check;};dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName, oldObj){if (this.xmlDoc.responseXML){var temp = this.xmlDoc.responseXML.getElementsByTagName(tagName);if(temp.length==0 && tagName.indexOf(":")!=-1)
 var temp = this.xmlDoc.responseXML.getElementsByTagName((tagName.split(":"))[1]);var z = temp[0];}else
 var z = this.xmlDoc.documentElement;if (z){this._retry=false;return z;}
 if (!this._retry){this._retry=true;var oldObj = this.xmlDoc;this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/,""), true);return this.getXMLTopNode(tagName, oldObj);}
 dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (oldObj||this.xmlDoc),
 this.mainObject
 ]);return document.createElement("DIV");};dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString, silent){if (!_isIE){var parser = new DOMParser();this.xmlDoc=parser.parseFromString(xmlString, "text/xml");}else {this.xmlDoc=new ActiveXObject("Microsoft.XMLDOM");this.xmlDoc.async=this.async;this.xmlDoc.onreadystatechange = function(){};this.xmlDoc["loadXM"+"L"](xmlString);}
 
 if (silent)return;if (this.onloadAction)this.onloadAction(this.mainObject, null, null, null, this);if (this.waitCall){this.waitCall();this.waitCall=null;}
}
dtmlXMLLoaderObject.prototype.loadXML=function(filePath, postMode, postVars, rpc){if (this.rSeed)filePath+=((filePath.indexOf("?") != -1) ? "&" : "?")+"a_dhx_rSeed="+(new Date()).valueOf();this.filePath=filePath;if ((!_isIE)&&(window.XMLHttpRequest))
 this.xmlDoc=new XMLHttpRequest();else {this.xmlDoc=new ActiveXObject("Microsoft.XMLHTTP");}
 if (this.async)this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this);this.xmlDoc.open(postMode ? "POST" : "GET", filePath, this.async);if (rpc){this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 ("+navigator.userAgent+")");this.xmlDoc.setRequestHeader("Content-type", "text/xml");}
 else if (postMode)this.xmlDoc.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');this.xmlDoc.setRequestHeader("X-Requested-With","XMLHttpRequest");this.xmlDoc.send(null||postVars);if (!this.async)(new this.waitLoadFunction(this))();};dtmlXMLLoaderObject.prototype.destructor=function(){this._filterXPath = null;this._getAllNamedChilds = null;this._retry = null;this.async = null;this.rSeed = null;this.filePath = null;this.onloadAction = null;this.mainObject = null;this.xmlDoc = null;this.doXPath = null;this.doXPathOpera = null;this.doXSLTransToObject = null;this.doXSLTransToString = null;this.loadXML = null;this.loadXMLString = null;this.doSerialization = null;this.xmlNodeToJSON = null;this.getXMLTopNode = null;this.setXSLParamValue = null;return null;}
dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(node){var t={};for (var i=0;i<node.attributes.length;i++)t[node.attributes[i].name]=node.attributes[i].value;t["_tagvalue"]=node.firstChild?node.firstChild.nodeValue:"";for (var i=0;i<node.childNodes.length;i++){var name=node.childNodes[i].tagName;if (name){if (!t[name])t[name]=[];t[name].push(this.xmlNodeToJSON(node.childNodes[i]));}
 }
 return t;}
function callerFunction(funcObject, dhtmlObject){this.handler=function(e){if (!e)e=window.event;funcObject(e, dhtmlObject);return true;};return this.handler;};function getAbsoluteLeft(htmlObject){return getOffset(htmlObject).left;}
function getAbsoluteTop(htmlObject){return getOffset(htmlObject).top;}
function getOffsetSum(elem) {var top=0, left=0;while(elem){top = top + parseInt(elem.offsetTop);left = left + parseInt(elem.offsetLeft);elem = elem.offsetParent;}
 return {top: top, left: left};}
function getOffsetRect(elem) {var box = elem.getBoundingClientRect();var body = document.body;var docElem = document.documentElement;var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;var clientTop = docElem.clientTop || body.clientTop || 0;var clientLeft = docElem.clientLeft || body.clientLeft || 0;var top = box.top + scrollTop - clientTop;var left = box.left + scrollLeft - clientLeft;return {top: Math.round(top), left: Math.round(left) };}
function getOffset(elem) {if (elem.getBoundingClientRect){return getOffsetRect(elem);}else {return getOffsetSum(elem);}
}
function convertStringToBoolean(inputString){if (typeof (inputString)== "string")
 inputString=inputString.toLowerCase();switch (inputString){case "1":
 case "true":
 case "yes":
 case "y":
 case 1:
 case true:
 return true;break;default: return false;}
}
function getUrlSymbol(str){if (str.indexOf("?")!= -1)
 return "&"
 else
 return "?"
}
function dhtmlDragAndDropObject(){if (window.dhtmlDragAndDrop)return window.dhtmlDragAndDrop;this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this;};dhtmlDragAndDropObject.prototype.removeDraggableItem=function(htmlNode){htmlNode.onmousedown=null;htmlNode.dragStarter=null;htmlNode.dragLanding=null;}
dhtmlDragAndDropObject.prototype.addDraggableItem=function(htmlNode, dhtmlObject){htmlNode.onmousedown=this.preCreateDragCopy;htmlNode.dragStarter=dhtmlObject;this.addDragLanding(htmlNode, dhtmlObject);}
dhtmlDragAndDropObject.prototype.addDragLanding=function(htmlNode, dhtmlObject){htmlNode.dragLanding=dhtmlObject;}
dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(e){if ((e||window.event)&& (e||event).button == 2)
 return;if (window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false;}
 
 if (window.dhtmlDragAndDrop.dragNode)window.dhtmlDragAndDrop.stopDrag(e);window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;window.dhtmlDragAndDrop.downtime = new Date().valueOf();if ((e)&&(e.preventDefault)){e.preventDefault();return false;}
 return false;};dhtmlDragAndDropObject.prototype.callDrag=function(e){if (!e)e=window.event;dragger=window.dhtmlDragAndDrop;if ((new Date()).valueOf()-dragger.downtime<100) return;if (!dragger.dragNode){if (dragger.waitDrag){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode, e);if (!dragger.dragNode)return dragger.stopDrag();dragger.dragNode.onselectstart=function(){return false;}
 dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute();}
 else return dragger.stopDrag(e, true);}
 if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode){var grd = dragger.gldragNode;if (dragger.gldragNode.old)grd=dragger.gldragNode.old;grd.parentNode.removeChild(grd);var oldBody = dragger.dragNode.pWindow;if (grd.pWindow && grd.pWindow.dhtmlDragAndDrop.lastLanding)grd.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(grd.pWindow.dhtmlDragAndDrop.lastLanding);if (_isIE){var div = document.createElement("Div");div.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=div.childNodes[0];}else
 dragger.dragNode=dragger.dragNode.cloneNode(true);dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);oldBody.dhtmlDragAndDrop.dragNode=dragger.dragNode;}
 dragger.dragNode.style.left=e.clientX+15+(dragger.fx
 ? dragger.fx*(-1)
 : 0)
 +(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=e.clientY+3+(dragger.fy
 ? dragger.fy*(-1)
 : 0)
 +(document.body.scrollTop||document.documentElement.scrollTop)+"px";if (!e.srcElement)var z = e.target;else
 z=e.srcElement;dragger.checkLanding(z, e);}
dhtmlDragAndDropObject.prototype.calculateFramePosition=function(n){if (window.name){var el = parent.frames[window.name].frameElement.offsetParent;var fx = 0;var fy = 0;while (el){fx+=el.offsetLeft;fy+=el.offsetTop;el=el.offsetParent;}
 if ((parent.dhtmlDragAndDrop)){var ls = parent.dhtmlDragAndDrop.calculateFramePosition(1);fx+=ls.split('_')[0]*1;fy+=ls.split('_')[1]*1;}
 if (n)return fx+"_"+fy;else
 this.fx=fx;this.fy=fy;}
 return "0_0";}
dhtmlDragAndDropObject.prototype.checkLanding=function(htmlObject, e){if ((htmlObject)&&(htmlObject.dragLanding)){if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding);this.lastLanding=htmlObject;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, e.clientX,
 e.clientY, e);this.lastLanding_scr=(_isIE ? e.srcElement : e.target);}else {if ((htmlObject)&&(htmlObject.tagName != "BODY"))
 this.checkLanding(htmlObject.parentNode, e);else {if (this.lastLanding)this.lastLanding.dragLanding._dragOut(this.lastLanding, e.clientX, e.clientY, e);this.lastLanding=0;if (this._onNotFound)this._onNotFound();}
 }
}
dhtmlDragAndDropObject.prototype.stopDrag=function(e, mode){dragger=window.dhtmlDragAndDrop;if (!mode){dragger.stopFrameRoute();var temp = dragger.lastLanding;dragger.lastLanding=null;if (temp)temp.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, temp, (_isIE
 ? event.srcElement
 : e.target));}
 dragger.lastLanding=null;if ((dragger.dragNode)&&(dragger.dragNode.parentNode == document.body))
 dragger.dragNode.parentNode.removeChild(dragger.dragNode);dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0;}
dhtmlDragAndDropObject.prototype.stopFrameRoute=function(win){if (win)window.dhtmlDragAndDrop.stopDrag(1, 1);for (var i = 0;i < window.frames.length;i++){try{if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.stopFrameRoute(window);}catch(e){}
 }
 try{if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
 parent.dhtmlDragAndDrop.stopFrameRoute(window);}catch(e){}
}
dhtmlDragAndDropObject.prototype.initFrameRoute=function(win, mode){if (win){window.dhtmlDragAndDrop.preCreateDragCopy();window.dhtmlDragAndDrop.dragStartNode=win.dhtmlDragAndDrop.dragStartNode;window.dhtmlDragAndDrop.dragStartObject=win.dhtmlDragAndDrop.dragStartObject;window.dhtmlDragAndDrop.dragNode=win.dhtmlDragAndDrop.dragNode;window.dhtmlDragAndDrop.gldragNode=win.dhtmlDragAndDrop.dragNode;window.document.body.onmouseup=window.dhtmlDragAndDrop.stopDrag;window.waitDrag=0;if (((!_isIE)&&(mode))&&((!_isFF)||(_FFrv < 1.8)))
 window.dhtmlDragAndDrop.calculateFramePosition();}
 try{if ((parent.dhtmlDragAndDrop)&&(parent != window)&&(parent != win))
 parent.dhtmlDragAndDrop.initFrameRoute(window);}catch(e){}
 for (var i = 0;i < window.frames.length;i++){try{if ((window.frames[i] != win)&&(window.frames[i].dhtmlDragAndDrop))
 window.frames[i].dhtmlDragAndDrop.initFrameRoute(window, ((!win||mode) ? 1 : 0));}catch(e){}
 }
}
 _isFF = false;_isIE = false;_isOpera = false;_isKHTML = false;_isMacOS = false;_isChrome = false;_FFrv = false;_KHTMLrv = false;_OperaRv = false;if (navigator.userAgent.indexOf('Macintosh')!= -1)
 _isMacOS=true;if (navigator.userAgent.toLowerCase().indexOf('chrome')>-1)
 _isChrome=true;if ((navigator.userAgent.indexOf('Safari')!= -1)||(navigator.userAgent.indexOf('Konqueror') != -1)){_KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Safari')+7, 5));if (_KHTMLrv > 525){_isFF=true;_FFrv = 1.9;}else
 _isKHTML=true;}else if (navigator.userAgent.indexOf('Opera')!= -1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf('Opera')+6, 3));}
else if (navigator.appName.indexOf("Microsoft")!= -1){_isIE=true;if ((navigator.appVersion.indexOf("MSIE 8.0")!= -1 || navigator.appVersion.indexOf("MSIE 9.0")!= -1 || navigator.appVersion.indexOf("MSIE 10.0")!= -1 ) && document.compatMode != "BackCompat"){_isIE=8;}
}else {_isFF=true;_FFrv = parseFloat(navigator.userAgent.split("rv:")[1])
}
dtmlXMLLoaderObject.prototype.doXPath=function(xpathExp, docObj, namespace, result_type){if (_isKHTML || (!_isIE && !window.XPathResult))
 return this.doXPathOpera(xpathExp, docObj);if (_isIE){if (!docObj)if (!this.xmlDoc.nodeName)docObj=this.xmlDoc.responseXML
 else
 docObj=this.xmlDoc;if (!docObj)dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (docObj||this.xmlDoc),
 this.mainObject
 ]);if (namespace != null)docObj.setProperty("SelectionNamespaces", "xmlns:xsl='"+namespace+"'");if (result_type == 'single'){return docObj.selectSingleNode(xpathExp);}
 else {return docObj.selectNodes(xpathExp)||new Array(0);}
 }else {var nodeObj = docObj;if (!docObj){if (!this.xmlDoc.nodeName){docObj=this.xmlDoc.responseXML
 }
 else {docObj=this.xmlDoc;}
 }
 if (!docObj)dhtmlxError.throwError("LoadXML", "Incorrect XML", [
 (docObj||this.xmlDoc),
 this.mainObject
 ]);if (docObj.nodeName.indexOf("document")!= -1){nodeObj=docObj;}
 else {nodeObj=docObj;docObj=docObj.ownerDocument;}
 var retType = XPathResult.ANY_TYPE;if (result_type == 'single')retType=XPathResult.FIRST_ORDERED_NODE_TYPE
 var rowsCol = new Array();var col = docObj.evaluate(xpathExp, nodeObj, function(pref){return namespace
 }, retType, null);if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE){return col.singleNodeValue;}
 var thisColMemb = col.iterateNext();while (thisColMemb){rowsCol[rowsCol.length]=thisColMemb;thisColMemb=col.iterateNext();}
 return rowsCol;}
}
function _dhtmlxError(type, name, params){if (!this.catches)this.catches=new Array();return this;}
_dhtmlxError.prototype.catchError=function(type, func_name){this.catches[type]=func_name;}
_dhtmlxError.prototype.throwError=function(type, name, params){if (this.catches[type])return this.catches[type](type, name, params);if (this.catches["ALL"])return this.catches["ALL"](type, name, params);alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]);return null;}
window.dhtmlxError=new _dhtmlxError();dtmlXMLLoaderObject.prototype.doXPathOpera=function(xpathExp, docObj){var z = xpathExp.replace(/[\/]+/gi, "/").split('/');var obj = null;var i = 1;if (!z.length)return [];if (z[0] == ".")obj=[docObj];else if (z[0] == ""){obj=(this.xmlDoc.responseXML||this.xmlDoc).getElementsByTagName(z[i].replace(/\[[^\]]*\]/g, ""));i++;}else
 return [];for (i;i < z.length;i++)obj=this._getAllNamedChilds(obj, z[i]);if (z[i-1].indexOf("[")!= -1)
 obj=this._filterXPath(obj, z[i-1]);return obj;}
dtmlXMLLoaderObject.prototype._filterXPath=function(a, b){var c = new Array();var b = b.replace(/[^\[]*\[\@/g, "").replace(/[\[\]\@]*/g, "");for (var i = 0;i < a.length;i++)if (a[i].getAttribute(b))
 c[c.length]=a[i];return c;}
dtmlXMLLoaderObject.prototype._getAllNamedChilds=function(a, b){var c = new Array();if (_isKHTML)b=b.toUpperCase();for (var i = 0;i < a.length;i++)for (var j = 0;j < a[i].childNodes.length;j++){if (_isKHTML){if (a[i].childNodes[j].tagName&&a[i].childNodes[j].tagName.toUpperCase()== b)
 c[c.length]=a[i].childNodes[j];}
 else if (a[i].childNodes[j].tagName == b)c[c.length]=a[i].childNodes[j];}
 return c;}
function dhtmlXHeir(a, b){for (var c in b)if (typeof (b[c])== "function")
 a[c]=b[c];return a;}
function dhtmlxEvent(el, event, handler){if (el.addEventListener)el.addEventListener(event, handler, false);else if (el.attachEvent)el.attachEvent("on"+event, handler);}
dtmlXMLLoaderObject.prototype.xslDoc=null;dtmlXMLLoaderObject.prototype.setXSLParamValue=function(paramName, paramValue, xslDoc){if (!xslDoc)xslDoc=this.xslDoc

 if (xslDoc.responseXML)xslDoc=xslDoc.responseXML;var item =
 this.doXPath("/xsl:stylesheet/xsl:variable[@name='"+paramName+"']", xslDoc,
 "http:/\/www.w3.org/1999/XSL/Transform", "single");if (item != null)item.firstChild.nodeValue=paramValue
}
dtmlXMLLoaderObject.prototype.doXSLTransToObject=function(xslDoc, xmlDoc){if (!xslDoc)xslDoc=this.xslDoc;if (xslDoc.responseXML)xslDoc=xslDoc.responseXML

 if (!xmlDoc)xmlDoc=this.xmlDoc;if (xmlDoc.responseXML)xmlDoc=xmlDoc.responseXML

 
 if (!_isIE){if (!this.XSLProcessor){this.XSLProcessor=new XSLTProcessor();this.XSLProcessor.importStylesheet(xslDoc);}
 var result = this.XSLProcessor.transformToDocument(xmlDoc);}else {var result = new ActiveXObject("Msxml2.DOMDocument.3.0");try{xmlDoc.transformNodeToObject(xslDoc, result);}catch(e){result = xmlDoc.transformNode(xslDoc);}
 }
 return result;}
dtmlXMLLoaderObject.prototype.doXSLTransToString=function(xslDoc, xmlDoc){var res = this.doXSLTransToObject(xslDoc, xmlDoc);if(typeof(res)=="string")
 return res;return this.doSerialization(res);}
dtmlXMLLoaderObject.prototype.doSerialization=function(xmlDoc){if (!xmlDoc)xmlDoc=this.xmlDoc;if (xmlDoc.responseXML)xmlDoc=xmlDoc.responseXML
 if (!_isIE){var xmlSerializer = new XMLSerializer();return xmlSerializer.serializeToString(xmlDoc);}else
 return xmlDoc.xml;}
dhtmlxEventable=function(obj){obj.attachEvent=function(name, catcher, callObj){name='ev_'+name.toLowerCase();if (!this[name])this[name]=new this.eventCatcher(callObj||this);return(name+':'+this[name].addEvent(catcher));}
 obj.callEvent=function(name, arg0){name='ev_'+name.toLowerCase();if (this[name])return this[name].apply(this, arg0);return true;}
 obj.checkEvent=function(name){return (!!this['ev_'+name.toLowerCase()])
 }
 obj.eventCatcher=function(obj){var dhx_catch = [];var z = function(){var res = true;for (var i = 0;i < dhx_catch.length;i++){if (dhx_catch[i] != null){var zr = dhx_catch[i].apply(obj, arguments);res=res&&zr;}
 }
 return res;}
 z.addEvent=function(ev){if (typeof (ev)!= "function")
 ev=eval(ev);if (ev)return dhx_catch.push(ev)-1;return false;}
 z.removeEvent=function(id){dhx_catch[id]=null;}
 return z;}
 obj.detachEvent=function(id){if (id != false){var list = id.split(':');this[list[0]].removeEvent(list[1]);}
 }
 obj.detachAllEvents = function(){for (var name in this){if (name.indexOf("ev_")==0) 
 delete this[name];}
 }
 obj = null;};if(!window.dhtmlx)window.dhtmlx = {};(function(){var _dhx_msg_cfg = null;function callback(config, result){var usercall = config.callback;modality(false);config.box.parentNode.removeChild(config.box);_dhx_msg_cfg = config.box = null;if (usercall)usercall(result);}
 function modal_key(e){if (_dhx_msg_cfg){e = e||event;var code = e.which||event.keyCode;if (dhtmlx.message.keyboard){if (code == 13 || code == 32)callback(_dhx_msg_cfg, true);if (code == 27)callback(_dhx_msg_cfg, false);}
 if (e.preventDefault)e.preventDefault();return !(e.cancelBubble = true);}
 }
 if (document.attachEvent)document.attachEvent("onkeydown", modal_key);else
 document.addEventListener("keydown", modal_key, true);function modality(mode){if(!modality.cover){modality.cover = document.createElement("DIV");modality.cover.onkeydown = modal_key;modality.cover.className = "dhx_modal_cover";document.body.appendChild(modality.cover);}
 var height = document.body.scrollHeight;modality.cover.style.display = mode?"inline-block":"none";}
 function button(text, result){return "<div class='dhtmlx_popup_button' result='"+result+"' ><div>"+text+"</div></div>";}
 function info(text){if (!t.area){t.area = document.createElement("DIV");t.area.className = "dhtmlx_message_area";t.area.style[t.position]="5px";document.body.appendChild(t.area);}
 t.hide(text.id);var message = document.createElement("DIV");message.innerHTML = "<div>"+text.text+"</div>";message.className = "dhtmlx-info dhtmlx-" + text.type;message.onclick = function(){t.hide(text.id);text = null;};if (t.position == "bottom" && t.area.firstChild)t.area.insertBefore(message,t.area.firstChild);else
 t.area.appendChild(message);if (text.expire > 0)t.timers[text.id]=window.setTimeout(function(){t.hide(text.id);}, text.expire);t.pull[text.id] = message;message = null;return text.id;}
 function _boxStructure(config, ok, cancel){var box = document.createElement("DIV");box.className = " dhtmlx_modal_box dhtmlx-"+config.type;box.setAttribute("dhxbox", 1);var inner = '';if (config.width)box.style.width = config.width;if (config.height)box.style.height = config.height;if (config.title)inner+='<div class="dhtmlx_popup_title">'+config.title+'</div>';inner+='<div class="dhtmlx_popup_text"><span>'+(config.content?'':config.text)+'</span></div><div class="dhtmlx_popup_controls">';if (ok)inner += button(config.ok || "OK", true);if (cancel)inner += button(config.cancel || "Cancel", false);if (config.buttons){for (var i=0;i<config.buttons.length;i++)inner += button(config.buttons[i],i);}
 inner += '</div>';box.innerHTML = inner;if (config.content){var node = config.content;if (typeof node == "string")node = document.getElementById(node);if (node.style.display == 'none')node.style.display = "";box.childNodes[config.title?1:0].appendChild(node);}
 box.onclick = function(e){e = e ||event;var source = e.target || e.srcElement;if (!source.className)source = source.parentNode;if (source.className == "dhtmlx_popup_button"){result = source.getAttribute("result");result = (result == "true")||(result == "false"?false:result);callback(config, result);}
 };config.box = box;if (ok||cancel)_dhx_msg_cfg = config;return box;}
 function _createBox(config, ok, cancel){var box = config.tagName ? config : _boxStructure(config, ok, cancel);if (!config.hidden)modality(true);document.body.appendChild(box);var x = Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth) - box.offsetWidth)/2));var y = Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight) - box.offsetHeight)/2));if (config.position == "top")box.style.top = "-3px";else
 box.style.top = y+'px';box.style.left = x+'px';box.onkeydown = modal_key;box.focus();if (config.hidden)dhtmlx.modalbox.hide(box);return box;}
 function alertPopup(config){return _createBox(config, true, false);}
 function confirmPopup(config){return _createBox(config, true, true);}
 function boxPopup(config){return _createBox(config);}
 function box_params(text, type, callback){if (typeof text != "object"){if (typeof type == "function"){callback = type;type = "";}
 text = {text:text, type:type, callback:callback };}
 return text;}
 function params(text, type, expire, id){if (typeof text != "object")text = {text:text, type:type, expire:expire, id:id};text.id = text.id||t.uid();text.expire = text.expire||t.expire;return text;}
 dhtmlx.alert = function(){text = box_params.apply(this, arguments);text.type = text.type || "confirm";return alertPopup(text);};dhtmlx.confirm = function(){text = box_params.apply(this, arguments);text.type = text.type || "alert";return confirmPopup(text);};dhtmlx.modalbox = function(){text = box_params.apply(this, arguments);text.type = text.type || "alert";return boxPopup(text);};dhtmlx.modalbox.hide = function(node){while (node && node.getAttribute && !node.getAttribute("dhxbox"))
 node = node.parentNode;if (node){node.parentNode.removeChild(node);modality(false);}
 };var t = dhtmlx.message = function(text, type, expire, id){text = params.apply(this, arguments);text.type = text.type||"info";var subtype = text.type.split("-")[0];switch (subtype){case "alert":
 return alertPopup(text);case "confirm":
 return confirmPopup(text);case "modalbox":
 return boxPopup(text);default:
 return info(text);break;}
 };t.seed = (new Date()).valueOf();t.uid = function(){return t.seed++;};t.expire = 4000;t.keyboard = true;t.position = "top";t.pull = {};t.timers = {};t.hideAll = function(){for (var key in t.pull)t.hide(key);};t.hide = function(id){var obj = t.pull[id];if (obj && obj.parentNode){window.setTimeout(function(){obj.parentNode.removeChild(obj);obj = null;},2000);obj.className+=" hidden";if(t.timers[id])window.clearTimeout(t.timers[id]);delete t.pull[id];}
 };})();function dhtmlXAccordionItem(){}
function dhtmlXAccordion(baseId, skin) {if (!window.dhtmlXContainer){alert(this.i18n.dhxcontalert);return;}
 
 var that = this;this.skin = (skin != null ? skin : (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : "dhx_skyblue"));if (baseId == document.body){this._isAccFS = true;document.body.className += " dhxacc_fullscreened";var contObj = document.createElement("DIV");contObj.className = "dhxcont_global_layout_area";baseId.appendChild(contObj);this.cont = new dhtmlXContainer(baseId);this.cont.setContent(contObj);baseId.adjustContent(baseId, 0);this.base = document.createElement("DIV");this.base.className = "dhx_acc_base_"+this.skin;this.base.style.overflow = "hidden";this.base.style.position = "absolute";this._adjustToFullScreen = function() {this.base.style.left = "2px";this.base.style.top = "2px";this.base.style.width = parseInt(contObj.childNodes[0].style.width)-4+"px";this.base.style.height = parseInt(contObj.childNodes[0].style.height)-4+"px";}
 this._adjustToFullScreen();contObj.childNodes[0].appendChild(this.base);this._resizeTM = null;this._resizeTMTime = 400;this._doOnResize = function() {window.clearTimeout(that._resizeTM);that._resizeTM = window.setTimeout(function(){that._adjustAccordion();}, that._resizeTMTime);}
 this._adjustAccordion = function() {document.body.adjustContent(document.body, 0);this._adjustToFullScreen();this.setSizes();}
 dhtmlxEvent(window, "resize", this._doOnResize);}else {this.base = (typeof(baseId)=="string"?document.getElementById(baseId):baseId);this.base.className = "dhx_acc_base_"+this.skin;this.base.innerHTML = "";}
 this.w = this.base.offsetWidth;this.h = this.base.offsetHeight;this.skinParams = {"dhx_blue": {"cell_height": 24, "cell_space": 1, "content_offset": 1 },
 "dhx_skyblue": {"cell_height": 27, "cell_space":-1, "content_offset":-1 },
 "dhx_black": {"cell_height": 24, "cell_space": 1, "content_offset": 1 },
 "dhx_web": {"cell_height": 26, "cell_space": 9, "content_offset": 0, "cell_pading_max": 1, "cell_pading_min": 0 },
 "dhx_terrace": {"cell_height": 37, "cell_space":-1, "content_offset": -1 }
 };this.sk = this.skinParams[this.skin];this.setSkinParameters = function(cellSpace, contentOffset) {if (!isNaN(cellSpace)) this.sk["cell_space"] = cellSpace;if (!isNaN(contentOffset)) this.sk["content_offset"] = contentOffset;this._reopenItem();}
 
 this.setSkin = function(skin) {if (!this.skinParams[skin])return;this.skin = skin;this.sk = this.skinParams[this.skin];this.base.className = "dhx_acc_base_"+this.skin+(this._r?" dhx_acc_rtl":"");for (var a in this.idPull)this.idPull[a].skin = this.skin;this._reopenItem();}
 
 this.idPull = {};this.opened = null;this.cells = function(itemId) {if (this.idPull[itemId] == null){return null;}
 return this.idPull[itemId];}
 
 
 this.itemH = 90;this.multiMode = false;this.enableMultiMode = function() {var totalItems = 0;for (var a in this.idPull)totalItems++;if (totalItems == 0){if (!this.userOffset)this.skinParams["dhx_skyblue"]["cell_space"] = 3;this.multiMode = true;}
 if (this.skin == "dhx_terrace"){this.skinParams["dhx_terrace"]["cell_space"] = 12;}
 }
 
 this.userOffset = false;this.setOffset = function(cellOffset, contentOffset) {this.userOffset = true;if (!isNaN(cellOffset)) this.skinParams[this.skin]["cell_space"] = cellOffset;if (!isNaN(contentOffset)) this.skinParams[this.skin]["content_offset"] = contentOffset;this.setSizes();}
 
 this.imagePath = "";this.setIconsPath = function(path) {this.imagePath = path;}
 
 
 this.addItem = function(itemId, itemText) {if (this.multiMode){var lastVis = this._lastVisible();}else {}
 
 
 var item = document.createElement("DIV");item.className = "dhx_acc_item";item.dir = "ltr";item._isAcc = true;item.skin = this.skin;this.base.appendChild(item);if (this.multiMode)item.h = this.itemH;var label = document.createElement("DIV");label._idd = itemId;label.className = "dhx_acc_item_label";label.innerHTML = "<span>"+itemText+"</span><div class='dhx_acc_item_label_btmbrd'>&nbsp;</div>"+
 "<div class='dhx_acc_item_arrow'></div>"+
 "<div class='dhx_acc_hdr_line_l'></div>"+
 "<div class='dhx_acc_hdr_line_r'></div>";label.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 label.onclick = function() {if (!that.multiMode && that.idPull[this._idd]._isActive)return;if (that.multiMode){if (that.idPull[this._idd]._isActive){if (that.checkEvent("onBeforeActive")) {if (that.callEvent("onBeforeActive", [this._idd, "close"])) that.closeItem(this._idd, "dhx_accord_outer_event");}else {that.closeItem(this._idd, "dhx_accord_outer_event");}
 }else {if (that.checkEvent("onBeforeActive")) {if (that.callEvent("onBeforeActive", [this._idd, "open"])) that.openItem(this._idd, "dhx_accord_outer_event");}else {that.openItem(this._idd, "dhx_accord_outer_event");}
 }
 if (that._autoHeightEnabled)that.setSizes();return;}
 
 if (that.checkEvent("onBeforeActive")) {if (that.callEvent("onBeforeActive", [this._idd, "open"])) that.openItem(this._idd, "dhx_accord_outer_event");}else {that.openItem(this._idd, "dhx_accord_outer_event");}
 }
 label.onmouseover = function() {this.className = "dhx_acc_item_label dhx_acc_item_lavel_hover";}
 label.onmouseout = function() {this.className = "dhx_acc_item_label";}
 item.appendChild(label);var contObj = document.createElement("DIV");contObj.className = "dhxcont_global_content_area";item.appendChild(contObj);var cont = new dhtmlXContainer(item);cont.setContent(contObj);if (this.skin == "dhx_terrace" && this._hideBorders === true){item._setPadding([0,-1,2,0]);}
 
 item.adjustContent(item, this.sk["cell_height"]+this.sk["content_offset"]);item._id = itemId;this.idPull[itemId] = item;item.getId = function() {return this._id;}
 
 item.setText = function(text) {that.setText(this._id, text);}
 
 item.getText = function() {return that.getText(this._id);}
 
 item.open = function() {that.openItem(this._id);}
 
 item.isOpened = function() {return that.isActive(this._id);}
 
 item.close = function() {that.closeItem(this._id);}
 
 item.setIcon = function(icon) {that.setIcon(this._id, icon);}
 
 item.clearIcon = function() {that.clearIcon(this._id);}
 
 item.dock = function() {that.dockItem(this._id);}
 
 item.undock = function() {that.undockItem(this._id);}
 
 item.show = function() {that.showItem(this._id);}
 
 item.hide = function() {that.hideItem(this._id);}
 
 item.setHeight = function(height) {that.setItemHeight(this._id, height);}
 item.moveOnTop = function() {that.moveOnTop(this._id);}
 
 item._doOnAttachMenu = function() {that._reopenItem();}
 item._doOnAttachToolbar = function() {that._reopenItem();}
 item._doOnAttachStatusBar = function() {that._reopenItem();}
 
 item._doOnFrameContentLoaded = function(){that.callEvent("onContentLoaded",[this]);}
 
 if (this.multiMode && lastVis != null){if (lastVis._isActive == true){this.idPull[lastVis._id].adjustContent(this.idPull[lastVis._id], this.sk["cell_height"]+this.sk["content_offset"], null, null, this.sk["cell_space"]);this.idPull[lastVis._id].updateNestedObjects();}else {this.idPull[lastVis._id].style.height = this.sk["cell_height"]+this.sk["cell_space"]+"px";}
 lastVis = null;}
 
 
 var e = this._enableOpenEffect;this._enableOpenEffect = false;this.openItem(itemId);this._enableOpenEffect = e;if (!this.multiMode)this._defineLastItem();else this.setSizes();return item;}
 
 this.openItem = function(itemId, callEvent, reOpenItem) {if (this.multiMode)this._checkAutoHeight();if (this._openBuzy)return;if (this._enableOpenEffect && !reOpenItem){if (this.multiMode && this.idPull[itemId]._isActive)return;this._openWithEffect(itemId, null, null, null, null, callEvent);return;}
 
 
 if (this.multiMode){for (var a in this.idPull){if (this.idPull[a]._isActive || a == itemId){this.idPull[a].style.height = this.idPull[a].h+"px";this.idPull[a].childNodes[1].style.display = "";if (this.skin == "dhx_web")this.idPull[a]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_acc_dhx_web");this.idPull[a].adjustContent(this.idPull[a], this.sk["cell_height"]+this.sk["content_offset"], null, null, (this.idPull[a]==this._lastVisible()&&this.skin!="dhx_web"?0:this.sk["cell_space"]));this.idPull[a].updateNestedObjects();this.idPull[a]._isActive = true;this._updateArrows();if (callEvent == "dhx_accord_outer_event" && a == itemId)this.callEvent("onActive", [itemId,true]);}
 }
 return;}
 
 
 if (itemId){if (this.idPull[itemId]._isActive && !reOpenItem)return;}
 
 var h = 0;for (var a in this.idPull){this.idPull[a].style.height = this.sk["cell_height"]+(this.idPull[a]!=this._lastVisible()&&a!=itemId?this.sk["cell_space"]:0)+"px";if (a != itemId){this.idPull[a].childNodes[1].style.display = "none";if (this.skin == "dhx_web")this.idPull[a]._setPadding(this.skinParams[this.skin]["cell_pading_min"], "");this.idPull[a]._isActive = false;h += this.idPull[a].offsetHeight;}
 }
 h = this.base.offsetHeight - h;if (itemId){this.idPull[itemId].style.height = h+"px";this.idPull[itemId].childNodes[1].style.display = "";if (this.skin == "dhx_web")this.idPull[itemId]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_acc_dhx_web");this.idPull[itemId].adjustContent(this.idPull[itemId], this.sk["cell_height"]+this.sk["content_offset"], null, null, (this.idPull[itemId]==this._lastVisible()?0:this.sk["cell_space"]));this.idPull[itemId].updateNestedObjects();this.idPull[itemId]._isActive = true;if (callEvent == "dhx_accord_outer_event")this.callEvent("onActive", [itemId,true]);}
 this._updateArrows();return;}
 
 
 this._lastVisible = function() {var item = null;for (var q=this.base.childNodes.length-1;q>=0;q--)if (!this.base.childNodes[q]._isHidden && !item)item = this.base.childNodes[q];return item;}
 
 this.closeItem = function(itemId, callEvent) {if (this.idPull[itemId] == null)return;if (!this.idPull[itemId]._isActive)return;if (this._openBuzy)return;if (this._enableOpenEffect){this._openWithEffect(this.multiMode?itemId:null, null, null, null, null, callEvent);return;}
 
 this.idPull[itemId].style.height = this.sk["cell_height"]+(this.idPull[itemId]!=this._lastVisible()?this.sk["cell_space"]:0)+"px";this.idPull[itemId].childNodes[1].style.display = "none";if (this.skin == "dhx_web")this.idPull[itemId]._setPadding(this.skinParams[this.skin]["cell_pading_min"], "");this.idPull[itemId]._isActive = false;if (callEvent == "dhx_accord_outer_event")this.callEvent("onActive", [itemId,false]);this._updateArrows();}
 
 this._updateArrows = function() {for (var a in this.idPull){var label = this.idPull[a].childNodes[0];var arrow = null;for (var q=0;q<label.childNodes.length;q++){if (String(label.childNodes[q].className).search("dhx_acc_item_arrow") != -1) arrow = label.childNodes[q];}
 if (arrow != null){arrow.className = "dhx_acc_item_arrow "+(this.idPull[a]._isActive?"item_opened":"item_closed");arrow = null;}
 }
 }
 
 this.setText = function(itemId, itemText, moveLabel) {if (that.idPull[itemId] == null)return;var label = that.idPull[itemId].childNodes[0];var tObj = null;for (var q=0;q<label.childNodes.length;q++){if (label.childNodes[q].tagName != null){if (String(label.childNodes[q].tagName).toLowerCase() == "span") tObj = label.childNodes[q];}
 }
 if (!isNaN(moveLabel)) {tObj.style.paddingLeft = moveLabel+"px";tObj.style.paddingRight = moveLabel+"px";}else {tObj.innerHTML = itemText;}
 }
 
 this.getText = function(itemId) {if (that.idPull[itemId] == null)return;var label = that.idPull[itemId].childNodes[0];var tObj = null;for (var q=0;q<label.childNodes.length;q++){if (label.childNodes[q].tagName != null){if (String(label.childNodes[q].tagName).toLowerCase() == "span") tObj = label.childNodes[q];}
 }
 return tObj.innerHTML;}
 
 this._initWindows = function(id) {if (!window.dhtmlXWindows)return;if (!this.dhxWins){this.dhxWins = new dhtmlXWindows();this.dhxWins.setSkin(this.skin);this.dhxWins.setImagePath(this.imagePath);this.dhxWinsIdPrefix = "";if (!id)return;}
 var idd = this.dhxWinsIdPrefix+id;if (!this.dhxWins.window(idd)) {var self = this;var w1 = this.dhxWins.createWindow(idd, 20, 20, 320, 200);w1.setText(this.getText(id));w1.button("close").hide();w1.attachEvent("onClose", function(win){win.hide();});w1.addUserButton("dock", 99, this.dhxWins.i18n.dock, "dock");w1.button("dock").attachEvent("onClick", function(win){self.cells(id).dock();});}else {this.dhxWins.window(idd).show();}
 
 }
 
 this.dockWindow = function(itemId) {if (!this.idPull[itemId]._isUnDocked)return;if (!this.dhxWins)return;if (!this.dhxWins.window(this.dhxWinsIdPrefix+itemId)) return;this.dhxWins.window(this.dhxWinsIdPrefix+itemId).moveContentTo(this.idPull[itemId]);this.dhxWins.window(this.dhxWinsIdPrefix+itemId).close();this.idPull[itemId]._isUnDocked = false;this.showItem(itemId);this.callEvent("onDock", [itemId]);}
 
 this.undockWindow = function(itemId) {if (this.idPull[itemId]._isUnDocked)return;this._initWindows(itemId);this.idPull[itemId].moveContentTo(this.dhxWins.window(this.dhxWinsIdPrefix+itemId));this.idPull[itemId]._isUnDocked = true;this.hideItem(itemId);this.callEvent("onUnDock", [itemId]);}
 
 
 this.setSizes = function() {this._reopenItem();}
 
 this.showItem = function(itemId) {if (this.idPull[itemId] == null)return;if (!this.idPull[itemId]._isHidden)return;if (this.idPull[itemId]._isUnDocked){this.dockItem(itemId);return;}
 this.idPull[itemId].className = "dhx_acc_item";this.idPull[itemId]._isHidden = false;this._defineLastItem();this._reopenItem();}
 
 this.hideItem = function(itemId) {if (this.idPull[itemId] == null)return;if (this.idPull[itemId]._isHidden)return;this.closeItem(itemId);this.idPull[itemId].className = "dhx_acc_item_hidden";this.idPull[itemId]._isHidden = true;this._defineLastItem();this._reopenItem();}
 
 this.isItemHidden = function(itemId) {if (this.idPull[itemId] == null)return;return (this.idPull[itemId]._isHidden == true);}
 
 this._reopenItem = function() {var toOpen = null;for (var a in this.idPull)if (this.idPull[a]._isActive && !this.idPull[a]._isHidden)toOpen = a;this.openItem(toOpen, null, true);}
 
 
 this.forEachItem = function(handler) {for (var a in this.idPull)handler(this.idPull[a]);}
 
 this._enableOpenEffect = false;this._openStep = 10;this._openStepIncrement = 5;this._openStepTimeout = 10;this._openBuzy = false;this.setEffect = function(state) {this._enableOpenEffect = (state==true?true:false);}
 
 this._openWithEffect = function(toOpen, toClose, minH, maxH, step, callEvent) {if (this.multiMode){if (!step){this._openBuzy = true;step = this._openStep;if (this.idPull[toOpen]._isActive){toClose = toOpen;toOpen = null;minH = this.sk["cell_height"]+(this.idPull[toClose]!=this._lastVisible()?this.sk["cell_space"]:0);this.idPull[toClose].childNodes[1].style.display = "";}else {maxH = this.idPull[toOpen].h;this.idPull[toOpen].childNodes[1].style.display = "";}
 }
 var stopOpen = false;if (toOpen){var newH = parseInt(this.idPull[toOpen].style.height||0)+step;if (newH > maxH){newH = maxH;stopOpen = true;}
 this.idPull[toOpen].style.height = newH+"px";}
 
 if (toClose){var newH = parseInt(this.idPull[toClose].style.height)-step;if (newH < minH){newH = minH;stopOpen = true;}
 this.idPull[toClose].style.height = newH+"px";}
 step += this._openStepIncrement;if (stopOpen){if (toOpen){this.idPull[toOpen].adjustContent(this.idPull[toOpen], this.sk["cell_height"]+this.sk["content_offset"], null, null, (this.idPull[toOpen]==this._lastVisible()?0:this.sk["cell_space"]));this.idPull[toOpen].updateNestedObjects();this.idPull[toOpen]._isActive = true;}
 if (toClose){this.idPull[toClose].childNodes[1].style.display = "none";this.idPull[toClose]._isActive = false;}
 this._updateArrows();this._openBuzy = false;if (toOpen && callEvent == "dhx_accord_outer_event")this.callEvent("onActive", [toOpen,true]);if (toClose && callEvent == "dhx_accord_outer_event")this.callEvent("onActive", [toClose,false]);}else {var that = this;window.setTimeout(function(){that._openWithEffect(toOpen, toClose, minH, maxH, step, callEvent);},this._openStepTimeout);}
 return;}
 
 
 if (!step){this._openBuzy = true;step = this._openStep;if (toOpen)this.idPull[toOpen].childNodes[1].style.display = "";}
 if (!toClose || !minH || !maxH){minH = 0;maxH = 0;for (var a in this.idPull){var th = this.sk["cell_height"]+(this.idPull[a]!=this._lastVisible()&&a!=toOpen?this.sk["cell_space"]:0);if (this.idPull[a]._isActive && toOpen != a){toClose = a;minH = th;}
 if (a != toOpen)maxH += th;}
 maxH = this.base.offsetHeight - maxH;}
 var stopOpen = false;if (toOpen){var ha = parseInt(this.idPull[toOpen].style.height)+step;if (ha > maxH)stopOpen = true;}
 if (toClose){var hb = parseInt(this.idPull[toClose].style.height)-step;if (hb < minH)stopOpen = true;}
 step += this._openStepIncrement;if (stopOpen){ha = maxH;hb = minH;}
 if (toClose)this.idPull[toClose].style.height = hb+"px";if (toOpen)this.idPull[toOpen].style.height = ha+"px";if (stopOpen){if (toClose){this.idPull[toClose].childNodes[1].style.display = "none";this.idPull[toClose]._isActive = false;}
 if (toOpen){this.idPull[toOpen].adjustContent(this.idPull[toOpen], this.sk["cell_height"]+this.sk["content_offset"], null, null, (this.idPull[toOpen]==this._lastVisible()?0:this.sk["cell_space"]));this.idPull[toOpen].updateNestedObjects();this.idPull[toOpen]._isActive = true;}
 this._updateArrows();this._openBuzy = false;if (callEvent == "dhx_accord_outer_event" && toOpen)this.callEvent("onActive", [toOpen,true]);}else {var that = this;window.setTimeout(function(){that._openWithEffect(toOpen, toClose, minH, maxH, step, callEvent);},this._openStepTimeout);}
 }
 
 this.setActive = function(itemId) {this.openItem(itemId);}
 this.isActive = function(itemId) {return (this.idPull[itemId]._isActive === true?true:false);}
 this.dockItem = function(itemId) {this.dockWindow(itemId);}
 
 this.undockItem = function(itemId) {this.undockWindow(itemId);}
 
 this.setItemHeight = function(itemId, height) {if (!this.multiMode)return;if (height == "*"){this.idPull[itemId].h_auto = true;}else {if (isNaN(height)) return;this.idPull[itemId].h_auto = false;this.idPull[itemId].h = height;}
 this._reopenItem();}
 
 this._checkAutoHeight = function() {var h = this.base.offsetHeight;this._autoHeightEnabled = false;var k = [];for (var a in this.idPull){if (!this._autoHeightEnabled && this.idPull[a].h_auto)this._autoHeightEnabled = true;if (this.idPull[a].h_auto && this.idPull[a]._isActive){k.push(a);}else {if (this.idPull[a]._isActive){h = Math.max(0, h-this.idPull[a].h);}else {h = Math.max(0, h-this.idPull[a].offsetHeight);}
 }
 }
 
 if (k.length > 0){var h1 = Math.floor(h/k.length);for (var q=0;q<k.length;q++){if (q == k.length-1)h1 = h;else h -= h1;this.idPull[k[q]].h = h1;}
 }
 
 }
 
 this.setIcon = function(itemId, icon) {if (this.idPull[itemId] == null)return;var label = this.idPull[itemId].childNodes[0];var iconObj = null;for (var q=0;q<label.childNodes.length;q++){if (label.childNodes[q].className == "dhx_acc_item_icon")iconObj = label.childNodes[q];}
 if (iconObj == null){iconObj = document.createElement("IMG");iconObj.className = "dhx_acc_item_icon";label.insertBefore(iconObj, label.childNodes[0]);this.setText(itemId, null, 20);}
 iconObj.src = this.imagePath+icon;}
 
 this.clearIcon = function(itemId) {if (this.idPull[itemId] == null)return;var label = this.idPull[itemId].childNodes[0];var iconObj = null;for (var q=0;q<label.childNodes.length;q++){if (label.childNodes[q].className == "dhx_acc_item_icon")iconObj = label.childNodes[q];}
 if (iconObj != null){label.removeChild(iconObj);iconObj = null;this.setText(itemId, null, 0);}
 }
 
 this.moveOnTop = function(itemId) {if (!this.idPull[itemId])return;if (this.base.childNodes.length <= 1)return;this.base.insertBefore(this.idPull[itemId], this.base.childNodes[0])
 this.setSizes();}
 
 this._defineLastItem = function() {if (this.multiMode)return;var done = false;for (var q=this.base.childNodes.length-1;q>=0;q--){if ((this.base.childNodes[q].className).search("last_item") >= 0) {if (this.base.childNodes[q]._isHidden || done){this.base.childNodes[q].className = String(this.base.childNodes[q].className).replace(/last_item/gi,"");}else {done = true;}
 
 }else {if (!this.base.childNodes[q]._isHidden && !done){this.base.childNodes[q].className += " last_item";done = true;}
 
 }
 }
 
 
 }
 
 
 this.removeItem = function(itemId) {var item = this.idPull[itemId];var label = item.childNodes[0];label.onclick = null;label.onmouseover = null;label.onmouseout = null;label.onselectstart = null;label._idd = null;label.className = "";item._dhxContDestruct();while (label.childNodes.length > 0)label.removeChild(label.childNodes[0]);if (label.parentNode)label.parentNode.removeChild(label);label = null;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item._dhxContDestruct = null;item._doOnAttachMenu = null;item._doOnAttachToolbar = null;item._doOnAttachStatusBar = null;item.clearIcon = null;item.close = null;item.dock = null;item.getId = null;item.getText = null;item.hide = null;item.isOpened = null;item.open = null;item.setHeight = null;item.setIcon = null;item.setText = null;item.show = null;item.undock = null;if (item.parentNode)item.parentNode.removeChild(item);item = null;this.idPull[itemId] = null;try {delete this.idPull[itemId];}catch(e){}
 
 }
 
 this.unload = function() {for (var a in this.skinParams){this.skinParams[a] = null;try {delete this.skinParams[a];}catch(e){}
 }
 this.skinParams = null;for (var a in this.idPull)this.removeItem(a);this.idPull = null;this.sk = null;this._initWindows = null;this._lastVisible = null;this._reopenItem = null;this._updateArrows = null;this.addItem = null;this.attachEvent = null;this.callEvent = null;this.cells = null;this.checkEvent = null;this.clearIcon = null;this.closeItem = null;this.detachEvent = null;this.dockItem = null;this.dockWindow = null;this.enableMultiMode = null;this.eventCatcher = null;this.forEachItem = null;this.getText = null;this.h = null;this.hideItem = null;this.imagePath = null;this.isActive = null;this.itemH = null;this.multiMode = null;this.openItem = null;this.removeItem = null;this.setActive = null;this.setEffect = null;this.setIcon = null;this.setIconsPath = null;this.setItemHeight = null;this.setOffset = null;this.setSizes = null;this.setSkin = null;this.setSkinParameters = null;this.setText = null;this.showItem = null;this.skin = null;this.w = null;this.undockItem = null;this.undockWindow = null;this.undockWindowunload = null;this.unload = null;this.userOffset = null;if (this._isAccFS == true){if (_isIE){window.detachEvent("onresize", this._doOnResize);}else {window.removeEventListener("resize", this._doOnResize, false);}
 this._isAccFS = null;this._doOnResize = null;this._adjustAccordion = null;this._adjustToFullScreen = null;this._resizeTM = null;this._resizeTMTime = null;document.body.className = String(document.body.className).replace("dhxacc_fullscreened","");this.cont.obj._dhxContDestruct();if (this.cont.dhxcont.parentNode)this.cont.dhxcont.parentNode.removeChild(this.cont.dhxcont);this.cont.dhxcont = null;this.cont.setContent = null;this.cont = null;}
 
 if (this.dhxWins){this.dhxWins.unload();this.dhxWins = null;}
 
 this.base.className = "";this.base = null;for (var a in this)try {delete this[a];}catch(e){};}
 
 this._initWindows();dhtmlxEventable(this);return this;};dhtmlXAccordion.prototype.i18n = {dhxcontalert: "dhtmlxcontainer.js is missed on the page"
};(function(){dhtmlx.extend_api("dhtmlXAccordion",{_init:function(obj){return [obj.parent, obj.skin];},
 icon_path:"setIconsPath",
 items:"_items",
 effect: "setEffect",
 multi_mode:"enableMultiMode"
 },{_items:function(arr){var toOpen = [];var toClose = [];for (var i=0;i < arr.length;i++){var item=arr[i];this.addItem(item.id, item.text);if (item.img)this.cells(item.id).setIcon(item.img);if (item.height)this.cells(item.id).setHeight(item.height);if (item.open === true)toOpen[toOpen.length] = item.id;if (item.open === false)toClose[toClose.length] = item.id;}
 for (var q=0;q<toOpen.length;q++)this.cells(toOpen[q]).open();for (var q=0;q<toClose.length;q++)this.cells(toClose[q]).close();}
 });})();dhtmlXAccordion.prototype.loadJSON = function(t) {var k = {skin:"setSkin",icons_path:"setIconsPath",multi_mode:"enableMultiMode",effect:"setEffect"};for (var a in k)if (typeof(t[a])!= "undefined") this[k[a]](t[a]);var toOpen = null;for (var q=0;q<t.cells.length;q++){this.addItem(t.cells[q].id, t.cells[q].text);if (typeof(t.cells[q].icon)!= "undefined") this.setIcon(t.cells[q].id, t.cells[q].icon);if (typeof(t.cells[q].height)!= "undefined") this.setItemHeight(t.cells[q].id, t.cells[q].height);if (typeof(t.cells[q].open)!= "undefined") toOpen = t.cells[q].id;}
 
 if (toOpen != null)this.openItem(toOpen);};dhtmlXAccordion.prototype.loadXML = function(url, onLoad) {var that = this;this.callEvent("onXLS", []);dhtmlxAjax.get(url, function(r){var root = r.xmlDoc.responseXML.getElementsByTagName("accordion")[0];var k = {0:false,"true":true,"1":true,"y":true,"yes":true};var t = {cells:[]};if (root.getAttribute("skin")!= null) t.skin = root.getAttribute("skin");if (root.getAttribute("iconsPath")!= null) t.icons_path = root.getAttribute("iconsPath");if (root.getAttribute("mode")== "multi") t.multi_mode = true;if (k[root.getAttribute("openEffect")||0]) t.effect = true;var toOpen = null;for (var q=0;q<root.childNodes.length;q++){if (typeof(root.childNodes[q].tagName)!= "indefined" && String(root.childNodes[q].tagName).toLowerCase() == "cell") {var id = (root.childNodes[q].getAttribute("id")||that._genStr(12));var text = (root.childNodes[q].firstChild.nodeValue||"");t.cells.push({id:id,text:text});if (root.childNodes[q].getAttribute("icon")!= null) t.cells[t.cells.length-1].icon = root.childNodes[q].getAttribute("icon");if (root.childNodes[q].getAttribute("height")!= null) t.cells[t.cells.length-1].height = root.childNodes[q].getAttribute("height");if (k[root.childNodes[q].getAttribute("open")||0]) t.cells[t.cells.length-1].open = true;}
 }
 that.loadJSON(t);that.callEvent("onXLE",[]);if (typeof(onLoad)== "function") onLoad();that = onLoad = null;});};function dhtmlXContainer(obj) {var that = this;this.obj = obj;obj = null;this.obj._padding = true;this.dhxcont = null;this.st = document.createElement("DIV");this.st.style.position = "absolute";this.st.style.left = "-200px";this.st.style.top = "0px";this.st.style.width = "100px";this.st.style.height = "1px";this.st.style.visibility = "hidden";this.st.style.overflow = "hidden";document.body.insertBefore(this.st, document.body.childNodes[0]);this.obj._getSt = function() {return that.st;}
 
 this.obj.dv = "def";this.obj.av = this.obj.dv;this.obj.cv = this.obj.av;this.obj.vs = {};this.obj.vs[this.obj.av] = {};this.obj.view = function(name) {if (!this.vs[name]){this.vs[name] = {};this.vs[name].dhxcont = this.vs[this.dv].dhxcont;var mainCont = document.createElement("DIV");mainCont.style.position = "relative";mainCont.style.left = "0px";mainCont.style.width = "200px";mainCont.style.height = "200px";mainCont.style.overflow = "hidden";mainCont.style.visibility = "";that.st.appendChild(mainCont);this.vs[name].dhxcont.mainCont[name] = mainCont;mainCont = null;}
 
 this.avt = this.av;this.av = name;return this;}
 
 this.obj.setActive = function() {if (!this.vs[this.av])return;this.cv = this.av;if (this.vs[this.avt].dhxcont == this.vs[this.avt].dhxcont.mainCont[this.avt].parentNode){that.st.appendChild(this.vs[this.avt].dhxcont.mainCont[this.avt]);if (this.vs[this.avt].menu)that.st.appendChild(document.getElementById(this.vs[this.avt].menuId));if (this.vs[this.avt].toolbar)that.st.appendChild(document.getElementById(this.vs[this.avt].toolbarId));if (this.vs[this.avt].sb)that.st.appendChild(document.getElementById(this.vs[this.avt].sbId));}
 
 
 
 
 if (this._isCell){}
 
 
 
 if (this.vs[this.av].dhxcont != this.vs[this.av].dhxcont.mainCont[this.av].parentNode){this.vs[this.av].dhxcont.insertBefore(this.vs[this.av].dhxcont.mainCont[this.av],this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]);if (this.vs[this.av].menu)this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].menuId), this.vs[this.av].dhxcont.childNodes[0]);if (this.vs[this.av].toolbar)this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].toolbarId), this.vs[this.av].dhxcont.childNodes[(this.vs[this.av].menu?1:0)]);if (this.vs[this.av].sb)this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].sbId), this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]);}
 
 if (this._doOnResize)this._doOnResize();if (this._isWindow)this.updateNestedObjects();this.avt = null;}
 
 this.obj._viewRestore = function() {var t = this.av;if (this.avt){this.av = this.avt;this.avt = null;}
 return t;}
 
 this.setContent = function(data) {this.obj.vs[this.obj.av].dhxcont = data;this.obj._init();data = null;}
 
 this.obj._init = function() {this.vs[this.av].dhxcont.innerHTML = "<div ida='dhxMainCont' style='position: relative;left: 0px;top: 0px;overflow: hidden;'></div>"+
 "<div class='dhxcont_content_blocker' style='display: none;'></div>";this.vs[this.av].dhxcont.mainCont = {};this.vs[this.av].dhxcont.mainCont[this.av] = this.vs[this.av].dhxcont.childNodes[0];}
 
 this.obj._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 
 this.obj.setMinContentSize = function(w, h) {this.vs[this.av]._minDataSizeW = w;this.vs[this.av]._minDataSizeH = h;}
 
 this.obj._setPadding = function(p, altCss) {if (typeof(p)== "object") {this._offsetTop = p[0];this._offsetLeft = p[1];this._offsetWidth = p[2];this._offsetHeight = p[3];p = null;}else {this._offsetTop = p;this._offsetLeft = p;this._offsetWidth = -p*2;this._offsetHeight = -p*2;}
 this.vs[this.av].dhxcont.className = "dhxcont_global_content_area "+(altCss||"");}
 
 this.obj.moveContentTo = function(cont) {for (var a in this.vs){cont.view(a).setActive();var pref = null;if (this.vs[a].grid)pref = "grid";if (this.vs[a].tree)pref = "tree";if (this.vs[a].tabbar)pref = "tabbar";if (this.vs[a].folders)pref = "folders";if (this.vs[a].layout)pref = "layout";if (pref != null){cont.view(a).attachObject(this.vs[a][pref+"Id"], false, true, false);cont.vs[a][pref] = this.vs[a][pref];cont.vs[a][pref+"Id"] = this.vs[a][pref+"Id"];cont.vs[a][pref+"Obj"] = this.vs[a][pref+"Obj"];this.vs[a][pref] = null;this.vs[a][pref+"Id"] = null;this.vs[a][pref+"Obj"] = null;}
 
 if (this.vs[a]._frame){cont.vs[a]._frame = this.vs[a]._frame;this.vs[a]._frame = null;}
 
 if (this.vs[a].menu != null){if (cont.cv == cont.av){cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].menuId), cont.vs[cont.av].dhxcont.childNodes[0]);}else {var st = cont._getSt();st.appendChild(document.getElementById(this.vs[a].menuId));st = null;}
 cont.vs[a].menu = this.vs[a].menu;cont.vs[a].menuId = this.vs[a].menuId;cont.vs[a].menuHeight = this.vs[a].menuHeight;this.vs[a].menu = null;this.vs[a].menuId = null;this.vs[a].menuHeight = null;if (this.cv == this.av && this._doOnAttachMenu)this._doOnAttachMenu("unload");if (cont.cv == cont.av && cont._doOnAttachMenu)cont._doOnAttachMenu("move");}
 
 if (this.vs[a].toolbar != null){if (cont.cv == cont.av){cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].toolbarId), cont.vs[cont.av].dhxcont.childNodes[(cont.vs[cont.av].menu!=null?1:0)]);}else {var st = cont._getSt();st.appendChild(document.getElementById(this.vs[a].toolbarId));st = null;}
 
 cont.vs[a].toolbar = this.vs[a].toolbar;cont.vs[a].toolbarId = this.vs[a].toolbarId;cont.vs[a].toolbarHeight = this.vs[a].toolbarHeight;this.vs[a].toolbar = null;this.vs[a].toolbarId = null;this.vs[a].toolbarHeight = null;if (this.cv == this.av && this._doOnAttachToolbar)this._doOnAttachToolbar("unload");if (cont.cv == cont.av && cont._doOnAttachToolbar)cont._doOnAttachToolbar("move");}
 
 if (this.vs[a].sb != null){if (cont.cv == cont.av){cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].sbId), cont.vs[cont.av].dhxcont.childNodes[cont.vs[cont.av].dhxcont.childNodes.length-1]);}else {var st = cont._getSt();st.appendChild(document.getElementById(this.vs[a].sbId));return st;}
 
 cont.vs[a].sb = this.vs[a].sb;cont.vs[a].sbId = this.vs[a].sbId;cont.vs[a].sbHeight = this.vs[a].sbHeight;this.vs[a].sb = null;this.vs[a].sbId = null;this.vs[a].sbHeight = null;if (this.cv == this.av && this._doOnAttachStatusBar)this._doOnAttachStatusBar("unload");if (cont.cv == cont.av && cont._doOnAttachStatusBar)cont._doOnAttachStatusBar("move");}
 
 
 var objA = this.vs[a].dhxcont.mainCont[a];var objB = cont.vs[a].dhxcont.mainCont[a];while (objA.childNodes.length > 0)objB.appendChild(objA.childNodes[0]);}
 
 cont.view(this.av).setActive();cont = null;}
 
 this.obj.adjustContent = function(parentObj, offsetTop, marginTop, notCalcWidth, offsetBottom) {var dhxcont = this.vs[this.av].dhxcont;var mainCont = dhxcont.mainCont[this.av];dhxcont.style.left = (this._offsetLeft||0)+"px";dhxcont.style.top = (this._offsetTop||0)+offsetTop+"px";var cw = parentObj.clientWidth+(this._offsetWidth||0);if (notCalcWidth !== true)dhxcont.style.width = Math.max(0, cw)+"px";if (notCalcWidth !== true)if (dhxcont.offsetWidth > cw)dhxcont.style.width = Math.max(0, cw*2-dhxcont.offsetWidth)+"px";var ch = parentObj.clientHeight+(this._offsetHeight||0);dhxcont.style.height = Math.max(0, ch-offsetTop)+(marginTop!=null?marginTop:0)+"px";if (dhxcont.offsetHeight > ch - offsetTop)dhxcont.style.height = Math.max(0, (ch-offsetTop)*2-dhxcont.offsetHeight)+"px";if (offsetBottom)if (!isNaN(offsetBottom)) dhxcont.style.height = Math.max(0, parseInt(dhxcont.style.height)-offsetBottom)+"px";if (this.vs[this.av]._minDataSizeH != null){if (parseInt(dhxcont.style.height)< this.vs[this.av]._minDataSizeH) dhxcont.style.height = this.vs[this.av]._minDataSizeH+"px";}
 if (this.vs[this.av]._minDataSizeW != null){if (parseInt(dhxcont.style.width)< this.vs[this.av]._minDataSizeW) dhxcont.style.width = this.vs[this.av]._minDataSizeW+"px";}
 
 if (notCalcWidth !== true){mainCont.style.width = dhxcont.clientWidth+"px";if (mainCont.offsetWidth > dhxcont.clientWidth)mainCont.style.width = Math.max(0, dhxcont.clientWidth*2-mainCont.offsetWidth)+"px";}
 
 var menuOffset = (this.vs[this.av].menu!=null?(!this.vs[this.av].menuHidden?this.vs[this.av].menuHeight:0):0);var toolbarOffset = (this.vs[this.av].toolbar!=null?(!this.vs[this.av].toolbarHidden?this.vs[this.av].toolbarHeight:0):0);var statusOffset = (this.vs[this.av].sb!=null?(!this.vs[this.av].sbHidden?this.vs[this.av].sbHeight:0):0);mainCont.style.height = dhxcont.clientHeight+"px";if (mainCont.offsetHeight > dhxcont.clientHeight)mainCont.style.height = Math.max(0, dhxcont.clientHeight*2-mainCont.offsetHeight)+"px";mainCont.style.height = Math.max(0, parseInt(mainCont.style.height)-menuOffset-toolbarOffset-statusOffset)+"px";mainCont = null;dhxcont = null;parentObj = null;}
 this.obj.coverBlocker = function() {return this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1];}
 this.obj.showCoverBlocker = function() {var t = this.coverBlocker();t.style.display = "";t = null;}
 this.obj.hideCoverBlocker = function() {var t = this.coverBlocker();t.style.display = "none";t = null;}
 this.obj.updateNestedObjects = function(fromInit) {if (this.skin == "dhx_terrace"){var mtAttached = (this.vs[this.av].menu != null || this.vs[this.av].toolbar != null);if (this.vs[this.av].grid){var gTop = (mtAttached||this._isWindow?14:0);var gBottom = (this._isWindow?14:0);var gLeft = (this._isWindow?14:0);if (fromInit){if (!this._isWindow){this.vs[this.av].grid.entBox.style.border = "0px solid white";this.vs[this.av].grid.skin_h_correction = -2;}
 
 this.vs[this.av].grid.dontSetSizes = true;this.vs[this.av].gridObj.style.position = "absolute";}
 
 this.vs[this.av].gridObj.style.top = gTop+"px";this.vs[this.av].gridObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gTop-gBottom+"px";this.vs[this.av].gridObj.style.left = gLeft+"px";this.vs[this.av].gridObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";this.vs[this.av].grid.setSizes();}
 
 if (this.vs[this.av].tree){var gTop = (mtAttached||this._isWindow?14:0);var gBottom = (this._isWindow?14:0);var gLeft = (this._isWindow?14:0);if (fromInit){this.vs[this.av].treeObj.style.position = "absolute";}
 
 this.vs[this.av].treeObj.style.top = gTop+"px";this.vs[this.av].treeObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gTop-gBottom+"px";this.vs[this.av].treeObj.style.left = gLeft+"px";this.vs[this.av].treeObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";}
 
 if (this.vs[this.av].form){var gTop = (mtAttached||this._isWindow?14:0);var gBottom = (this._isWindow?14:0);var gLeft = (this._isWindow?14:0);if (fromInit){this.vs[this.av].formObj.style.position = "absolute";}
 
 this.vs[this.av].formObj.style.top = gTop+"px";this.vs[this.av].formObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gTop-gBottom+"px";this.vs[this.av].formObj.style.left = gLeft+"px";this.vs[this.av].formObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";this.vs[this.av].form.setSizes();}
 
 if (this.vs[this.av].layout){if (fromInit){if (!this._isWindow && !this._isCell)this.vs[this.av].layout._hideBorders();}
 
 
 var gTop = (this._isCell&&this._noHeader&&!mtAttached?0:14);var gBottom = (this._isCell&&this._noHeader?0:14)
 var gLeft = (this._isCell&&this._noHeader?0:14);this.vs[this.av].layoutObj.style.top = gTop+"px";this.vs[this.av].layoutObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gTop-gBottom+"px";this.vs[this.av].layoutObj.style.left = gLeft+"px";this.vs[this.av].layoutObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";this.vs[this.av].layout.setSizes();}
 
 if (this.vs[this.av].accordion){if (fromInit){this.vs[this.av].accordion._hideBorders = true;}
 
 var gTop = (this._isCell&&this._noHeader&&!mtAttached?0:14);var gBottom = (this._isCell&&this._noHeader?0:14)
 var gLeft = (this._isCell&&this._noHeader?0:14);this.vs[this.av].accordionObj.style.top = gTop+"px";this.vs[this.av].accordionObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gTop-gBottom+"px";this.vs[this.av].accordionObj.style.left = gLeft+"px";this.vs[this.av].accordionObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";this.vs[this.av].accordion.setSizes();}
 
 
 if (this.vs[this.av].tabbar != null){var gTop = (!mtAttached && this._isCell && this._noHeader ? 0:14);var gBottom = (this._isCell && this._noHeader ? gTop : 28);var gLeft = (this._isCell && this._noHeader ? 0 : 14);this.vs[this.av].tabbarObj.style.top = gTop+"px";this.vs[this.av].tabbarObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-gBottom+"px";this.vs[this.av].tabbarObj.style.left = gLeft+"px";this.vs[this.av].tabbarObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";this.vs[this.av].tabbar.adjustOuterSize();}
 
 if (this.vs[this.av].editor){if (fromInit){if (this.vs[this.av].editor.tb != null && this.vs[this.av].editor.tb instanceof dhtmlXToolbarObject){}
 
 }
 
 var gTop = 14;var gLeft = 14;this.vs[this.av].editorObj.style.top = gTop+"px";this.vs[this.av].editorObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-(gTop*2)+"px";this.vs[this.av].editorObj.style.left = gLeft+"px";this.vs[this.av].editorObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)-(gLeft*2)+"px";if (!_isIE)this.vs[this.av].editor._prepareContent(true);this.vs[this.av].editor.setSizes();}
 
 
 if (this.vs[this.av].dockedCell){this.vs[this.av].dockedCell.updateNestedObjects();}
 
 return;}
 
 if (this.vs[this.av].grid){this.vs[this.av].grid.setSizes();}
 if (this.vs[this.av].sched){this.vs[this.av].sched.setSizes();}
 if (this.vs[this.av].tabbar){this.vs[this.av].tabbar.adjustOuterSize();}
 if (this.vs[this.av].folders){this.vs[this.av].folders.setSizes();}
 if (this.vs[this.av].editor){if (!_isIE)this.vs[this.av].editor._prepareContent(true);this.vs[this.av].editor.setSizes();}
 
 
 if (this.vs[this.av].layout){if ((this._isAcc || this._isTabbarCell)&& this.skin == "dhx_skyblue") {this.vs[this.av].layoutObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";this.vs[this.av].layoutObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";}else {this.vs[this.av].layoutObj.style.width = this.vs[this.av].dhxcont.mainCont[this.av].style.width;this.vs[this.av].layoutObj.style.height = this.vs[this.av].dhxcont.mainCont[this.av].style.height;}
 this.vs[this.av].layout.setSizes();}
 
 if (this.vs[this.av].accordion != null){if (this.skin == "dhx_web"){this.vs[this.av].accordionObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";this.vs[this.av].accordionObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";}else {this.vs[this.av].accordionObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";this.vs[this.av].accordionObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";}
 this.vs[this.av].accordion.setSizes();}
 
 if (this.vs[this.av].dockedCell){this.vs[this.av].dockedCell.updateNestedObjects();}
 
 if (this.vs[this.av].form)this.vs[this.av].form.setSizes();}
 
 this.obj.attachStatusBar = function() {if (this.vs[this.av].sb)return;var sbObj = document.createElement("DIV");if (this._isCell){sbObj.className = "dhxcont_sb_container_layoutcell";}else {sbObj.className = "dhxcont_sb_container";}
 sbObj.id = "sbobj_"+this._genStr(12);sbObj.innerHTML = "<div class='dhxcont_statusbar'></div>";if (this.cv == this.av)this.vs[this.av].dhxcont.insertBefore(sbObj, this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]);else that.st.appendChild(sbObj);sbObj.setText = function(text) {this.childNodes[0].innerHTML = text;}
 sbObj.getText = function() {return this.childNodes[0].innerHTML;}
 sbObj.onselectstart = function(e) {e=e||event;e.returnValue=false;return false;}
 
 this.vs[this.av].sb = sbObj;this.vs[this.av].sbHeight = (this.skin=="dhx_web"?41:(this.skin=="dhx_skyblue"?23:sbObj.offsetHeight));this.vs[this.av].sbId = sbObj.id;if (this._doOnAttachStatusBar)this._doOnAttachStatusBar("init");this.adjust();return this.vs[this._viewRestore()].sb;}
 
 this.obj.detachStatusBar = function() {if (!this.vs[this.av].sb)return;this.vs[this.av].sb.setText = null;this.vs[this.av].sb.getText = null;this.vs[this.av].sb.onselectstart = null;this.vs[this.av].sb.parentNode.removeChild(this.vs[this.av].sb);this.vs[this.av].sb = null;this.vs[this.av].sbHeight = null;this.vs[this.av].sbId = null;this._viewRestore();if (this._doOnAttachStatusBar)this._doOnAttachStatusBar("unload");}
 
 this.obj.getFrame = function(){return this.getView()._frame;};this.obj.getView = function(name){return this.vs[name||this.av];};this.obj.attachMenu = function(skin) {if (this.vs[this.av].menu)return;var menuObj = document.createElement("DIV");menuObj.style.position = "relative";menuObj.style.overflow = "hidden";menuObj.id = "dhxmenu_"+this._genStr(12);if (this.cv == this.av)this.vs[this.av].dhxcont.insertBefore(menuObj, this.vs[this.av].dhxcont.childNodes[0]);else that.st.appendChild(menuObj);if (typeof(skin)!= "object") {this.vs[this.av].menu = new dhtmlXMenuObject(menuObj.id, (skin||this.skin));}else {skin.parent = menuObj.id;this.vs[this.av].menu = new dhtmlXMenuObject(skin);}
 this.vs[this.av].menuHeight = (this.skin=="dhx_web"?29:menuObj.offsetHeight);this.vs[this.av].menuId = menuObj.id;if (this._doOnAttachMenu)this._doOnAttachMenu("init");this.adjust();return this.vs[this._viewRestore()].menu;}
 
 this.obj.detachMenu = function() {if (!this.vs[this.av].menu)return;var menuObj = document.getElementById(this.vs[this.av].menuId);this.vs[this.av].menu.unload();this.vs[this.av].menu = null;this.vs[this.av].menuId = null;this.vs[this.av].menuHeight = null;if (menuObj)menuObj.parentNode.removeChild(menuObj);menuObj = null;this._viewRestore();if (this._doOnAttachMenu)this._doOnAttachMenu("unload");}
 
 this.obj.attachToolbar = function(skin) {if (this.vs[this.av].toolbar)return;var toolbarObj = document.createElement("DIV");toolbarObj.style.position = "relative";toolbarObj.style.overflow = "hidden";toolbarObj.id = "dhxtoolbar_"+this._genStr(12);if (this.cv == this.av)this.vs[this.av].dhxcont.insertBefore(toolbarObj, this.vs[this.av].dhxcont.childNodes[(this.vs[this.av].menu!=null?1:0)]);else that.st.appendChild(toolbarObj);if (typeof(skin)!= "object") {this.vs[this.av].toolbar = new dhtmlXToolbarObject(toolbarObj.id, (skin||this.skin));}else {skin.parent = toolbarObj.id;this.vs[this.av].toolbar = new dhtmlXToolbarObject(skin);}
 this.vs[this.av].toolbarHeight = toolbarObj.offsetHeight;this.vs[this.av].toolbarId = toolbarObj.id;if (this._doOnAttachToolbar)this._doOnAttachToolbar("init");this.adjust();var t = this;this.vs[this.av].toolbar.attachEvent("_onIconSizeChange",function(size){t.vs[t.av].toolbarHeight = this.cont.offsetHeight;t.vs[t.av].toolbarId = this.cont.id;if (t._doOnAttachToolbar)t._doOnAttachToolbar("iconSizeChange");});if (this.skin != "dhx_terrace")this.vs[this.av].toolbar.callEvent("_onIconSizeChange",[]);return this.vs[this._viewRestore()].toolbar;}
 
 this.obj.detachToolbar = function() {if (!this.vs[this.av].toolbar)return;var toolbarObj = document.getElementById(this.vs[this.av].toolbarId);this.vs[this.av].toolbar.unload();this.vs[this.av].toolbar = null;this.vs[this.av].toolbarId = null;this.vs[this.av].toolbarHeight = null;if (toolbarObj)toolbarObj.parentNode.removeChild(toolbarObj);toolbarObj = null;this._viewRestore();if (this._doOnAttachToolbar)this._doOnAttachToolbar("unload");}
 
 this.obj.attachGrid = function() {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 
 var obj = document.createElement("DIV");obj.id = "dhxGridObj_"+this._genStr(12);obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "grid";document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);this.vs[this.av].grid = new dhtmlXGridObject(obj.id);this.vs[this.av].grid.setSkin(this.skin);if (this.skin == "dhx_skyblue" || this.skin == "dhx_black" || this.skin == "dhx_blue"){this.vs[this.av].grid.entBox.style.border = "0px solid white";this.vs[this.av].grid._sizeFix = 2;}
 this.vs[this.av].gridId = obj.id;this.vs[this.av].gridObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].grid;}
 
 this.obj.attachScheduler = function(day,mode,cont_id,scheduler) {scheduler = scheduler || window.scheduler;var ready = 0;if (cont_id){obj = document.getElementById(cont_id);if (obj)ready = 1;}
 if (!ready){var tabs = cont_id || '<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div><div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div><div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>';var obj = document.createElement("DIV");obj.id = "dhxSchedObj_"+this._genStr(12);obj.innerHTML = '<div id="'+obj.id+'" class="dhx_cal_container" style="width:100%;height:100%;"><div class="dhx_cal_navline"><div class="dhx_cal_prev_button">&nbsp;</div><div class="dhx_cal_next_button">&nbsp;</div><div class="dhx_cal_today_button"></div><div class="dhx_cal_date"></div>'+tabs+'</div><div class="dhx_cal_header"></div><div class="dhx_cal_data"></div></div>';document.body.appendChild(obj.firstChild);}
 
 this.attachObject(obj.id, false, true, false);this.vs[this.av].sched = scheduler;this.vs[this.av].schedId = obj.id;scheduler.setSizes = scheduler.update_view;scheduler.destructor=function(){};scheduler.init(obj.id,day,mode);return this.vs[this._viewRestore()].sched;}
 
 this.obj.attachTree = function(rootId) {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 
 var obj = document.createElement("DIV");obj.id = "dhxTreeObj_"+this._genStr(12);obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "tree";document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);this.vs[this.av].tree = new dhtmlXTreeObject(obj.id, "100%", "100%", (rootId||0));this.vs[this.av].tree.setSkin(this.skin);this.vs[this.av].tree.allTree.childNodes[0].style.marginTop = "2px";this.vs[this.av].tree.allTree.childNodes[0].style.marginBottom = "2px";this.vs[this.av].treeId = obj.id;this.vs[this.av].treeObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].tree;}
 
 this.obj.attachTabbar = function(mode) {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.style.border = "none";this.setDimension(this.w, this.h);}
 
 var obj = document.createElement("DIV");obj.id = "dhxTabbarObj_"+this._genStr(12);obj.style.width = "100%";obj.style.height = "100%";obj.style.overflow = "hidden";obj.cmp = "tabbar";if (!this._isWindow)obj._hideBorders = true;document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);if (this._isCell){this.hideHeader();obj._hideBorders = false;this._padding = false;}
 
 this.vs[this.av].tabbar = new dhtmlXTabBar(obj.id, mode||"top", (this.skin=="dhx_terrace"?null:20));if (!this._isWindow && this.skin != "dhx_terrace")this.vs[this.av].tabbar._s.expand = true;this.vs[this.av].tabbar.setSkin(this.skin);this.vs[this.av].tabbar.adjustOuterSize();this.vs[this.av].tabbarId = obj.id;this.vs[this.av].tabbarObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].tabbar;}
 
 this.obj.attachFolders = function() {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 var obj = document.createElement("DIV");obj.id = "dhxFoldersObj_"+this._genStr(12);obj.style.width = "100%";obj.style.height = "100%";obj.style.overflow = "hidden";obj.cmp = "folders";document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);this.vs[this.av].folders = new dhtmlxFolders(obj.id);this.vs[this.av].folders.setSizes();this.vs[this.av].foldersId = obj.id;this.vs[this.av].foldersObj = obj;return this.vs[this._viewRestore()].folders;}
 
 this.obj.attachAccordion = function() {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 
 var obj = document.createElement("DIV");obj.id = "dhxAccordionObj_"+this._genStr(12);this._padding = true;if (this.skin == "dhx_web"){obj.style.left = "0px";obj.style.top = "0px";obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";}else if (this.skin != "dhx_terrace"){obj.style.left = "-1px";obj.style.top = "-1px";obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";}
 
 
 obj.style.position = "relative";obj.cmp = "accordion";document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);this.vs[this.av].accordion = new dhtmlXAccordion(obj.id, this.skin);this.vs[this.av].accordion.setSizes();this.vs[this.av].accordionId = obj.id;this.vs[this.av].accordionObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].accordion;}
 
 this.obj.attachLayout = function(view, skin) {if (this._isCell && this.skin == "dhx_skyblue"){this.hideHeader();this.vs[this.av].dhxcont.style.border = "0px solid white";this.adjustContent(this.childNodes[0], 0);}
 
 if (this._isCell && this.skin == "dhx_web"){this.hideHeader();}
 
 this._padding = true;var obj = document.createElement("DIV");obj.id = "dhxLayoutObj_"+this._genStr(12);obj.style.overflow = "hidden";obj.style.position = "absolute";obj.style.left = "0px";obj.style.top = "0px";obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";if ((this._isTabbarCell || this._isAcc)&& (this.skin == "dhx_skyblue")) {obj.style.left = "-1px";obj.style.top = "-1px";obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";}
 
 
 obj.dhxContExists = true;obj.cmp = "layout";document.body.appendChild(obj);this.attachObject(obj.id, false, true, false);this.vs[this.av].layout = new dhtmlXLayoutObject(obj, view, (skin||this.skin));if (this._isWindow)this.attachEvent("_onBeforeTryResize", this.vs[this.av].layout._defineWindowMinDimension);this.vs[this.av].layoutId = obj.id;this.vs[this.av].layoutObj = obj;if (this.skin == "dhx_terrace"){if (this._isCell){this.style.backgroundColor = "transparent";this.vs[this.av].dhxcont.style.backgroundColor = "transparent";this.hideHeader();}
 this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].layout;}
 
 this.obj.attachEditor = function(skin) {if (this._isWindow && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 
 var obj = document.createElement("DIV");obj.id = "dhxEditorObj_"+this._genStr(12);obj.style.position = "relative";obj.style.display = "none";obj.style.overflow = "hidden";obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "editor";document.body.appendChild(obj);if (this.skin == "dhx_terrace")obj._attached = true;this.attachObject(obj.id, false, true, false);this.vs[this.av].editor = new dhtmlXEditor(obj.id, skin||this.skin);this.vs[this.av].editorId = obj.id;this.vs[this.av].editorObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects(true);}
 
 return this.vs[this._viewRestore()].editor;}
 
 this.obj.attachMap = function(opts) {var obj = document.createElement("DIV");obj.id = "GMapsObj_"+this._genStr(12);obj.style.position = "relative";obj.style.display = "none";obj.style.overflow = "hidden";obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "gmaps";document.body.appendChild(obj);this.attachObject(obj.id, false, true, true);if (!opts)opts = {center: new google.maps.LatLng(40.719837,-73.992348), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP};this.vs[this.av].gmaps = new google.maps.Map(obj, opts);return this.vs[this.av].gmaps;}
 
 
 this.obj.attachObject = function(obj, autoSize, localCall, adjustMT) {if (typeof(obj)== "string") obj = document.getElementById(obj);if (autoSize){obj.style.visibility = "hidden";obj.style.display = "";var objW = obj.offsetWidth;var objH = obj.offsetHeight;}
 this._attachContent("obj", obj);if (autoSize && this._isWindow){obj.style.visibility = "";this._adjustToContent(objW, objH);}
 
 if (this.skin == "dhx_terrace"){if (this.vs[this.av].menu != null || this.vs[this.av].toolbar != null){this.adjust(typeof(adjustMT)=="undefined"||adjustMT==true);this.updateNestedObjects(true);}
 }
 if (!localCall){this._viewRestore();}
 
 }
 
 this.obj.detachObject = function(remove, moveTo) {var p = null;var pObj = null;var t = ["tree","grid","layout","tabbar","accordion","folders"];for (var q=0;q<t.length;q++){if (this.vs[this.av][t[q]]){p = this.vs[this.av][t[q]];pObj = this.vs[this.av][t[q]+"Obj"];if (remove){if (p.unload)p.unload();if (p.destructor)p.destructor();while (pObj.childNodes.length > 0)pObj.removeChild(pObj.childNodes[0]);pObj.parentNode.removeChild(pObj);pObj = null;p = null;}else {document.body.appendChild(pObj);pObj.style.display = "none";}
 this.vs[this.av][t[q]] = null;this.vs[this.av][t[q]+"Id"] = null;this.vs[this.av][t[q]+"Obj"] = null;}
 }
 
 if (p != null && pObj != null)return new Array(p, pObj);if (remove && this.vs[this.av]._frame){this._detachURLEvents();this.vs[this.av]._frame = null;}
 
 var objA = this.vs[this.av].dhxcont.mainCont[this.av];while (objA.childNodes.length > 0){if (remove == true){objA.removeChild(objA.childNodes[0]);}else {var obj = objA.childNodes[0];if (moveTo != null){if (typeof(moveTo)!= "object") moveTo = document.getElementById(moveTo);moveTo.appendChild(obj);}else {document.body.appendChild(obj);}
 obj.style.display = "none";}
 }
 
 objA = moveTo = null;}
 
 
 this.obj.appendObject = function(obj) {if (typeof(obj)== "string") {obj = document.getElementById(obj);}
 this._attachContent("obj", obj, true);}
 
 this.obj.attachHTMLString = function(str) {this._attachContent("str", str);var z=str.match(/<script[^>]*>[^\f]*?<\/script>/g)||[];for (var i=0;i<z.length;i++){var s=z[i].replace(/<([\/]{0,1})script[^>]*>/g,"")
 if (s){if (window.execScript)window.execScript(s);else window.eval(s);}
 }
 }
 
 this.obj.attachURL = function(url, ajax) {this._attachContent((ajax==true?"urlajax":"url"), url, false);if (this.skin == "dhx_terrace"){if (this.vs[this.av].menu != null || this.vs[this.av].toolbar != null){this.adjust(true);this.updateNestedObjects(true);}
 }
 this._viewRestore();}
 this.obj.adjust = function(adjustMT) {if (this.skin == "dhx_skyblue"){if (this.vs[this.av].menu){if (this._isWindow || this._isLayout){this.vs[this.av].menu._topLevelOffsetLeft = 0;document.getElementById(this.vs[this.av].menuId).style.height = "26px";this.vs[this.av].menuHeight = document.getElementById(this.vs[this.av].menuId).offsetHeight;if (this._doOnAttachMenu)this._doOnAttachMenu("show");}
 if (this._isCell){document.getElementById(this.vs[this.av].menuId).className += " in_layoutcell";this.vs[this.av].menuHeight = 25;}
 if (this._isAcc){document.getElementById(this.vs[this.av].menuId).className += " in_acccell";this.vs[this.av].menuHeight = 25;}
 if (this._doOnAttachMenu)this._doOnAttachMenu("adjust");}
 if (this.vs[this.av].toolbar){if (this._isWindow){document.getElementById(this.vs[this.av].toolbarId).className += " in_window";}
 if (this._isLayout){document.getElementById(this.vs[this.av].toolbarId).className += " in_layout";}
 if (this._isCell){document.getElementById(this.vs[this.av].toolbarId).className += " in_layoutcell";}
 if (this._isAcc){document.getElementById(this.vs[this.av].toolbarId).className += " in_acccell";}
 if (this._isTabbarCell){document.getElementById(this.vs[this.av].toolbarId).className += " in_tabbarcell";}
 }
 }
 
 if (this.skin == "dhx_web"){if (this.vs[this.av].toolbar){if (this._isWindow){document.getElementById(this.vs[this.av].toolbarId).className += " in_window";}
 if (this._isLayout){document.getElementById(this.vs[this.av].toolbarId).className += " in_layout";}
 if (this._isCell){document.getElementById(this.vs[this.av].toolbarId).className += " in_layoutcell";}
 if (this._isAcc){document.getElementById(this.vs[this.av].toolbarId).className += " in_acccell";}
 if (this._isTabbarCell){document.getElementById(this.vs[this.av].toolbarId).className += " in_tabbarcell";}
 }
 }
 
 if (this.skin == "dhx_terrace"){var mtLRPad = 0;if (this._isWindow || this._isCell || this._isAcc || this._isTabbarCell)mtLRPad = 14;if (this._isCell && this._noHeader)mtLRPad = 0;var mtTPad = 0;if (this._isWindow || this._isCell || this._isAcc || this._isTabbarCell)mtTPad = 14;if (this._isCell && this._noHeader)mtTPad = 0;var mBPad = ((adjustMT == true && !this.vs[this.av].toolbar) || this._isLayout ? 14 : 0);var tBPad = (adjustMT == true || this._isLayout ? 14 : 0);var mtAttached = false;if (this.vs[this.av].menu){document.getElementById(this.vs[this.av].menuId).style.marginLeft = mtLRPad+"px";document.getElementById(this.vs[this.av].menuId).style.marginRight = mtLRPad+"px";document.getElementById(this.vs[this.av].menuId).style.marginTop = mtTPad+"px";document.getElementById(this.vs[this.av].menuId).style.marginBottom = mBPad+"px";this.vs[this.av].menuHeight = 32+mtTPad+mBPad;if (this._doOnAttachMenu)this._doOnAttachMenu("show");mtAttached = true;}
 
 if (this.vs[this.av].toolbar){if (mtTPad == 0 && this.vs[this.av].menu != null & this._isCell)mtTPad = 14;document.getElementById(this.vs[this.av].toolbarId).style.marginLeft = mtLRPad+"px";document.getElementById(this.vs[this.av].toolbarId).style.marginRight = mtLRPad+"px";document.getElementById(this.vs[this.av].toolbarId).style.marginTop = mtTPad+"px";document.getElementById(this.vs[this.av].toolbarId).style.marginBottom = tBPad+"px";this.vs[this.av].toolbarHeight = 32+mtTPad+tBPad;if (this._doOnAttachToolbar)this._doOnAttachToolbar("show");mtAttached = true;}
 }
 }
 
 
 this.obj._attachContent = function(type, obj, append) {if (append !== true){if (this.vs[this.av]._frame){this._detachURLEvents();this.vs[this.av]._frame = null;}
 while (this.vs[this.av].dhxcont.mainCont[this.av].childNodes.length > 0)this.vs[this.av].dhxcont.mainCont[this.av].removeChild(this.vs[this.av].dhxcont.mainCont[this.av].childNodes[0]);}
 
 if (type == "url"){if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this._redraw();}
 var fr = document.createElement("IFRAME");fr.frameBorder = 0;fr.border = 0;fr.style.width = "100%";fr.style.height = "100%";fr.setAttribute("src","javascript:false;");this.vs[this.av].dhxcont.mainCont[this.av].appendChild(fr);fr.src = obj;this.vs[this.av]._frame = fr;this._attachURLEvents();}else if (type == "urlajax"){if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";this._redraw();}
 var t = this;var tav = String(this.av).valueOf();var xmlParser = function(){var tmp = t.av;t.av = tav;t.attachHTMLString(this.xmlDoc.responseText, this);t.av = tmp;if (t._doOnFrameContentLoaded)t._doOnFrameContentLoaded();this.destructor();}
 var xmlLoader = new dtmlXMLLoaderObject(xmlParser, window);xmlLoader.dhxWindowObject = this;xmlLoader.loadXML(obj);}else if (type == "obj"){if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";this._redraw();}
 this.vs[this.av].dhxcont._frame = null;this.vs[this.av].dhxcont.mainCont[this.av].appendChild(obj);this.vs[this.av].dhxcont.mainCont[this.av].style.overflow = (append===true?"auto":"hidden");obj.style.display = "";}else if (type == "str"){if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue"){this.vs[this.av].dhxcont.mainCont[this.av].style.border = "#a4bed4 1px solid";this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";this._redraw();}
 this.vs[this.av].dhxcont._frame = null;this.vs[this.av].dhxcont.mainCont[this.av].innerHTML = obj;}
 }
 
 this.obj._attachURLEvents = function() {var t = this;var fr = this.vs[this.av]._frame;if (_isIE){fr.onreadystatechange = function(a) {if (fr.readyState == "complete"){try {fr.contentWindow.document.body.onmousedown=function(){if(t._doOnFrameMouseDown)t._doOnFrameMouseDown();};}catch(e){};try{if(t._doOnFrameContentLoaded)t._doOnFrameContentLoaded();}catch(e){};}
 }
 }else {fr.onload = function() {try{fr.contentWindow.onmousedown=function(){if(t._doOnFrameMouseDown)t._doOnFrameMouseDown();};}catch(e){};try{if(t._doOnFrameContentLoaded)t._doOnFrameContentLoaded();}catch(e){};}
 }
 }
 
 this.obj._detachURLEvents = function() {if (_isIE){try {this.vs[this.av]._frame.onreadystatechange = null;this.vs[this.av]._frame.contentWindow.document.body.onmousedown = null;this.vs[this.av]._frame.onload = null;}catch(e) {};}else {try {this.vs[this.av]._frame.contentWindow.onmousedown = null;this.vs[this.av]._frame.onload = null;}catch(e) {};}
 }
 
 this.obj.showMenu = function() {if (!(this.vs[this.av].menu && this.vs[this.av].menuId)) return;if (document.getElementById(this.vs[this.av].menuId).style.display != "none") return;this.vs[this.av].menuHidden = false;if (this._doOnAttachMenu)this._doOnAttachMenu("show");document.getElementById(this.vs[this.av].menuId).style.display = "";this._viewRestore();}
 
 this.obj.hideMenu = function() {if (!(this.vs[this.av].menu && this.vs[this.av].menuId)) return;if (document.getElementById(this.vs[this.av].menuId).style.display == "none") return;document.getElementById(this.vs[this.av].menuId).style.display = "none";this.vs[this.av].menuHidden = true;if (this._doOnAttachMenu)this._doOnAttachMenu("hide");this._viewRestore();}
 
 this.obj.showToolbar = function() {if (!(this.vs[this.av].toolbar && this.vs[this.av].toolbarId)) return;if (document.getElementById(this.vs[this.av].toolbarId).style.display != "none") return;this.vs[this.av].toolbarHidden = false;if (this._doOnAttachToolbar)this._doOnAttachToolbar("show");document.getElementById(this.vs[this.av].toolbarId).style.display = "";this._viewRestore();}
 
 this.obj.hideToolbar = function() {if (!(this.vs[this.av].toolbar && this.vs[this.av].toolbarId)) return;if (document.getElementById(this.vs[this.av].toolbarId).style.display == "none") return;this.vs[this.av].toolbarHidden = true;document.getElementById(this.vs[this.av].toolbarId).style.display = "none";if (this._doOnAttachToolbar)this._doOnAttachToolbar("hide");this._viewRestore();}
 
 this.obj.showStatusBar = function() {if (!(this.vs[this.av].sb && this.vs[this.av].sbId)) return;if (document.getElementById(this.vs[this.av].sbId).style.display != "none") return;this.vs[this.av].sbHidden = false;if (this._doOnAttachStatusBar)this._doOnAttachStatusBar("show");document.getElementById(this.vs[this.av].sbId).style.display = "";this._viewRestore();}
 
 this.obj.hideStatusBar = function() {if (!(this.vs[this.av].sb && this.vs[this.av].sbId)) return;if (document.getElementById(this.vs[this.av].sbId).style.display == "none") return;this.vs[this.av].sbHidden = true;document.getElementById(this.vs[this.av].sbId).style.display = "none";if (this._doOnAttachStatusBar)this._doOnAttachStatusBar("hide");this._viewRestore();}
 
 this.obj._dhxContDestruct = function() {var av = this.av;for (var a in this.vs){this.av = a;this.detachMenu();this.detachToolbar();this.detachStatusBar();this.detachObject(true);this.vs[a].dhxcont.mainCont[a] = null;}
 
 for (var a in this.vs){this.vs[a].dhxcont.mainCont = null;this.vs[a].dhxcont.innerHTML = "";this.vs[a].dhxcont = null;this.vs[a] = null;}
 this.vs = null;this.attachMenu = null;this.attachToolbar = null;this.attachStatusBar = null;this.detachMenu = null;this.detachToolbar = null;this.detachStatusBar = null;this.showMenu = null;this.showToolbar = null;this.showStatusBar = null;this.hideMenu = null;this.hideToolbar = null;this.hideStatusBar = null;this.attachGrid = null;this.attachScheduler = null;this.attachTree = null;this.attachTabbar = null;this.attachFolders = null;this.attachAccordion = null;this.attachLayout = null;this.attachEditor = null;this.attachObject = null;this.detachObject = null;this.appendObject = null;this.attachHTMLString = null;this.attachURL = null;this.attachMap = null;this.view = null;this.show = null;this.adjust = null;this.setMinContentSize = null;this.moveContentTo = null;this.adjustContent = null;this.coverBlocker = null;this.showCoverBlocker = null;this.hideCoverBlocker = null;this.updateNestedObjects = null;this._attachContent = null;this._attachURLEvents = null;this._detachURLEvents = null;this._viewRestore = null;this._setPadding = null;this._init = null;this._genStr = null;this._dhxContDestruct = null;this._getSt = null;this.getFrame = null;this.getView = null;this.setActive = null;that.st.innerHTML = "";that.st.parentNode.removeChild(that.st);that.st = null;that.setContent = null;that.dhxcont = null;that.obj = null;that = null;if (dhtmlx.detaches)for (var a in dhtmlx.detaches)dhtmlx.detaches[a](this);}
 
 
 if (dhtmlx.attaches)for (var a in dhtmlx.attaches)this.obj[a] = dhtmlx.attaches[a];return this;}
function dhtmlXCalendarObject(inps, skin) {this.i = {};this.uid = function() {if (!this.uidd)this.uidd = new Date().getTime();return this.uidd++;}
 
 var p = null;if (typeof(inps)== "string") {var t0 = document.getElementById(inps);}else {var t0 = inps;}
 if (t0 && typeof(t0)== "object" && t0.tagName && String(t0.tagName).toLowerCase() != "input") p = t0;t0 = null;if (typeof(inps)!= "object" || !inps.length) inps = [inps];for (var q=0;q<inps.length;q++){if (typeof(inps[q])== "string") inps[q] = (document.getElementById(inps[q])||null);if (inps[q] != null && inps[q].tagName && String(inps[q].tagName).toLowerCase() == "input") {this.i[this.uid()] = inps[q];}
 inps[q] = null;}
 
 this.skin = (skin != null ? skin : (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : "dhx_skyblue"));this.setSkin = function(skin){this.skin = skin;this.base.className = "dhtmlxcalendar_container dhtmlxcalendar_skin_"+this.skin;this._ifrSize();}
 
 
 this.base = document.createElement("DIV");this.base.className = "dhtmlxcalendar_container";this.base.style.display = "none";if (p != null){this._hasParent = true;p.appendChild(this.base);p = null;}else {document.body.appendChild(this.base);}
 
 this.setParent = function(p) {if (this._hasParent){if (typeof(p)== "object") {p.appendChild(this.base);}else if (typeof(p)== "string") {document.getElementById(p).appendChild(this.base);}
 }
 }
 
 this.setSkin(this.skin);this.base.onclick = function(e) {e = e||event;e.cancelBubble = true;}
 
 this.loadUserLanguage = function(lang) {if (!this.langData[lang])return;this.lang = lang;this.setWeekStartDay(this.langData[this.lang].weekstart);if (this.msCont){var e = 0;for (var q=0;q<this.msCont.childNodes.length;q++){for (var w=0;w<this.msCont.childNodes[q].childNodes.length;w++){this.msCont.childNodes[q].childNodes[w].innerHTML = this.langData[this.lang].monthesSNames[e++];}
 }
 }
 }
 
 
 this.contMonth = document.createElement("DIV");this.contMonth.className = "dhtmlxcalendar_month_cont";this.contMonth.onselectstart = function(e){e=e||event;e.cancelBubble=true;e.returnValue=false;return false;}
 this.base.appendChild(this.contMonth);var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_line";this.contMonth.appendChild(ul);var li = document.createElement("LI");li.className = "dhtmlxcalendar_cell dhtmlxcalendar_month_hdr";li.innerHTML = "<div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left\";'></div>"+
 "<span class='dhtmlxcalendar_month_label_month'>Month</span><span class='dhtmlxcalendar_month_label_year'>Year</span>"+
 "<div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right\";'></div>";ul.appendChild(li);var that = this;li.onclick = function(e) {e = e||event;var t = (e.target||e.srcElement);if (t.className && t.className.indexOf("dhtmlxcalendar_month_arrow")=== 0) {that._hideSelector();var ind = (t.parentNode.firstChild==t?-1:1);var k0 = new Date(that._activeMonth);that._drawMonth(new Date(that._activeMonth.getFullYear(), that._activeMonth.getMonth()+ind, 1, 0, 0, 0, 0));that.callEvent("onArrowClick", [k0, new Date(that._activeMonth)]);return;}
 
 if (t.className && t.className == "dhtmlxcalendar_month_label_month"){e.cancelBubble = true;that._showSelector("month",31,21,"selector_month",true);return;}
 
 if (t.className && t.className == "dhtmlxcalendar_month_label_year"){e.cancelBubble = true;that._showSelector("year",42,21,"selector_year",true);return;}
 
 that._hideSelector();}
 
 
 this.contDays = document.createElement("DIV");this.contDays.className = "dhtmlxcalendar_days_cont";this.base.appendChild(this.contDays);this.setWeekStartDay = function(ind) {if (ind == 0)ind = 7;this._wStart = Math.min(Math.max((isNaN(ind)?1:ind),1),7);this._drawDaysOfWeek();}
 
 this._drawDaysOfWeek = function() {if (this.contDays.childNodes.length == 0){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_line";this.contDays.appendChild(ul);}else {var ul = this.contDays.firstChild;}
 
 var w = this._wStart;var k = this.langData[this.lang].daysSNames;k.push(String(this.langData[this.lang].daysSNames[0]).valueOf());for (var q=0;q<7;q++){if (ul.childNodes[q] == null){var li = document.createElement("LI");ul.appendChild(li);}else {var li = ul.childNodes[q];}
 li.className = "dhtmlxcalendar_cell"+(w>=6?" dhtmlxcalendar_day_weekday_cell":"")+(q==0?"_first":"");li.innerHTML = k[w];if (++w > 7)w = 1;}
 if (this._activeMonth != null)this._drawMonth(this._activeMonth);}
 
 this._wStart = this.langData[this.lang].weekstart;this.setWeekStartDay(this._wStart);this.contDates = document.createElement("DIV");this.contDates.className = "dhtmlxcalendar_dates_cont";this.base.appendChild(this.contDates);this.contDates.onclick = function(e){e = e||event;var t = (e.target||e.srcElement);if (t._date != null && !t._css_dis){var t1 = that._activeDate.getHours();var t2 = that._activeDate.getMinutes();var d0 = t._date;if (that.checkEvent("onBeforeChange")) {if (!that.callEvent("onBeforeChange",[new Date(t._date.getFullYear(),t._date.getMonth(),t._date.getDate(),t1,t2)])) return;}
 
 if (that._activeDateCell != null){that._activeDateCell._css_date = false;that._updateCellStyle(that._activeDateCell._q, that._activeDateCell._w);}
 
 
 var refreshView = (that._hasParent && that._activeDate.getFullYear()+"_"+that._activeDate.getMonth() != d0.getFullYear()+"_"+d0.getMonth());that._nullDate = false;that._activeDate = new Date(d0.getFullYear(),d0.getMonth(),d0.getDate(),t1,t2);that._activeDateCell = t;that._activeDateCell._css_date = true;that._activeDateCell._css_hover = false;that._lastHover = null;that._updateCellStyle(that._activeDateCell._q, that._activeDateCell._w);if (refreshView)that._drawMonth(that._activeDate);if (that._activeInp && that.i[that._activeInp]){that.i[that._activeInp].value = that._dateToStr(new Date(that._activeDate.getTime()));}
 
 if (!that._hasParent)that._hide();that.callEvent("onClick",[new Date(that._activeDate.getTime())]);}
 }
 
 this.contDates.onmouseover = function(e) {e = e||event;var t = (e.target||e.srcElement);if (t._date != null){t._css_hover = true;that._updateCellStyle(t._q, t._w);that._lastHover = t;}
 }
 this.contDates.onmouseout = function() {that._clearDayHover();}
 
 this._lastHover = null;this._clearDayHover = function() {if (!this._lastHover)return;this._lastHover._css_hover = false;this._updateCellStyle(this._lastHover._q, this._lastHover._w);this._lastHover = null;}
 
 
 for (var q=0;q<6;q++){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_line";this.contDates.appendChild(ul);for (var w=0;w<7;w++){var li = document.createElement("LI");li.className = "dhtmlxcalendar_cell";ul.appendChild(li);}
 }
 
 
 
 
 this.contTime = document.createElement("DIV");this.contTime.className = "dhtmlxcalendar_time_cont";this.base.appendChild(this.contTime);this.showTime = function() {if (String(this.base.className).search("dhtmlxcalendar_time_hidden") > 0) this.base.className = String(this.base.className).replace(/dhtmlxcalendar_time_hidden/gi,"");this._ifrSize();}
 
 this.hideTime = function() {if (String(this.base.className).search("dhtmlxcalendar_time_hidden") < 0) this.base.className += " dhtmlxcalendar_time_hidden";this._ifrSize();}
 
 var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_line";this.contTime.appendChild(ul);var li = document.createElement("LI");li.className = "dhtmlxcalendar_cell dhtmlxcalendar_time_hdr";li.innerHTML = "<div class='dhtmlxcalendar_time_label'></div><span class='dhtmlxcalendar_label_hours'></span><span class='dhtmlxcalendar_label_colon'>:</span><span class='dhtmlxcalendar_label_minutes'></span>";ul.appendChild(li);li.onclick = function(e) {e = e||event;var t = (e.target||e.srcElement);if (t.className && t.className == "dhtmlxcalendar_label_hours"){e.cancelBubble = true;that._showSelector("hours",3,115,"selector_hours",true);return;}
 
 if (t.className && t.className == "dhtmlxcalendar_label_minutes"){e.cancelBubble = true;that._showSelector("minutes",59,115,"selector_minutes",true);return;}
 
 that._hideSelector();}
 
 
 this._activeMonth = null;this._activeDate = new Date();this._activeDateCell = null;this.setDate = function(d) {this._nullDate = (typeof(d) == "undefined" || d === "" || !d);if (!(d instanceof Date)) {d = this._strToDate(String(d||""));if (d == "Invalid Date")d = new Date();}
 
 var time = d.getTime();if (this._isOutOfRange(time)) return;this._activeDate = new Date(time);this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleHours();this._updateVisibleMinutes();}
 
 this.getDate = function(formated) {if (this._nullDate)return null;var t = new Date(this._activeDate.getTime());if (formated)return this._dateToStr(t);return t;}
 
 this._drawMonth = function(d) {if (!(d instanceof Date)) return;if (isNaN(d.getFullYear())) d = new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), 1, 0, 0, 0, 0);this._activeMonth = new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);this._activeDateCell = null;var first = new Date(this._activeMonth.getTime());var d0 = first.getDay();var e0 = d0-this._wStart;if (e0 < 0)e0 = e0+7;first.setDate(first.getDate()-e0);var mx = d.getMonth();var dx = new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), this._activeDate.getDate(), 0, 0, 0, 0).getTime();var i = 0;for (var q=0;q<6;q++){var ws = this._wStart;for (var w=0;w<7;w++){var d2 = new Date(first.getFullYear(), first.getMonth(), first.getDate()+i++, 0, 0, 0, 0);this.contDates.childNodes[q].childNodes[w].innerHTML = d2.getDate();var day = d2.getDay();var time = d2.getTime();this.contDates.childNodes[q].childNodes[w]._date = new Date(time);this.contDates.childNodes[q].childNodes[w]._q = q;this.contDates.childNodes[q].childNodes[w]._w = w;this.contDates.childNodes[q].childNodes[w]._css_month = (d2.getMonth()==mx);this.contDates.childNodes[q].childNodes[w]._css_date = (!this._nullDate&&time==dx);this.contDates.childNodes[q].childNodes[w]._css_weekend = (ws>=6);this.contDates.childNodes[q].childNodes[w]._css_dis = this._isOutOfRange(time);this.contDates.childNodes[q].childNodes[w]._css_holiday = (this._holidays[time] == true);this._updateCellStyle(q, w);if (time==dx)this._activeDateCell = this.contDates.childNodes[q].childNodes[w];if (++ws > 7)ws = 1;}
 }
 
 this.contMonth.firstChild.firstChild.childNodes[1].innerHTML = this.langData[this.lang].monthesFNames[d.getMonth()];this.contMonth.firstChild.firstChild.childNodes[2].innerHTML = d.getFullYear();}
 
 this._updateCellStyle = function(q, w) {var r = this.contDates.childNodes[q].childNodes[w];var s = "dhtmlxcalendar_cell dhtmlxcalendar_cell";s += (r._css_month ? "_month" : "");s += (r._css_date ? "_date" : "");s += (r._css_weekend ? "_weekend" : "");s += (r._css_holiday ? "_holiday" : "");s += (r._css_dis ? "_dis" : "");s += (r._css_hover && !r._css_dis ? "_hover" : "");r.className = s;r = null;}
 
 
 
 this._initSelector = function(type,css) {if (!this._selCover){this._selCover = document.createElement("DIV");this._selCover.className = "dhtmlxcalendar_selector_cover";this.base.appendChild(this._selCover);}
 if (!this._sel){this._sel = document.createElement("DIV");this._sel.className = "dhtmlxcalendar_selector_obj";this.base.appendChild(this._sel);this._sel.appendChild(document.createElement("TABLE"));this._sel.firstChild.className = "dhtmlxcalendar_selector_table";this._sel.firstChild.cellSpacing = 0;this._sel.firstChild.cellPadding = 0;this._sel.firstChild.border = 0;this._sel.firstChild.appendChild(document.createElement("TBODY"));this._sel.firstChild.firstChild.appendChild(document.createElement("TR"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.childNodes[0].className = "dhtmlxcalendar_selector_cell_left";this._sel.firstChild.firstChild.firstChild.childNodes[1].className = "dhtmlxcalendar_selector_cell_middle";this._sel.firstChild.firstChild.firstChild.childNodes[2].className = "dhtmlxcalendar_selector_cell_right";this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML = "&nbsp;";this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML = "&nbsp;";this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover = function(){this.className = "dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover";}
 this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout = function(){this.className = "dhtmlxcalendar_selector_cell_left";}
 
 this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover = function(){this.className = "dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover";}
 this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout = function(){this.className = "dhtmlxcalendar_selector_cell_right";}
 
 this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick = function(e){e = e||event;e.cancelBubble = true;that._scrollYears(-1);}
 
 this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick = function(e){e = e||event;e.cancelBubble = true;that._scrollYears(1);}
 
 this._sel._ta = {};this._selHover = null;this._sel.onmouseover = function(e) {e = e||event;var t = (e.target||e.srcElement);if (t._cell === true){if (that._selHover != t)that._clearSelHover();if (String(t.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi) !=null) {t.className += " dhtmlxcalendar_selector_cell_hover";that._selHover = t;}
 }
 }
 
 this._sel.onmouseout = function() {that._clearSelHover();}
 
 this._sel.appendChild(document.createElement("DIV"));this._sel.lastChild.className = "dhtmlxcalendar_selector_obj_arrow";}
 
 
 if (this._sel._ta[type] == true)return;if (type == "month"){this._msCells = {};this.msCont = document.createElement("DIV");this.msCont.className = "dhtmlxcalendar_area_"+css;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont);var i = 0;for (var q=0;q<4;q++){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_selector_line";this.msCont.appendChild(ul);for (var w=0;w<3;w++){var li = document.createElement("LI");li.innerHTML = this.langData[this.lang].monthesSNames[i];li.className = "dhtmlxcalendar_selector_cell";ul.appendChild(li);li._month = i;li._cell = true;this._msCells[i++] = li;}
 }
 
 this.msCont.onclick = function(e) {e = e||event;e.cancelBubble = true;var t = (e.target||e.srcElement);if (t._month != null){that._hideSelector();that._updateActiveMonth();that._drawMonth(new Date(that._activeMonth.getFullYear(), t._month, 1, 0, 0, 0, 0));that._doOnSelectorChange();}
 }
 
 }
 
 
 if (type == "year"){this._ysCells = {};this.ysCont = document.createElement("DIV");this.ysCont.className = "dhtmlxcalendar_area_"+css;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont);for (var q=0;q<4;q++){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_selector_line";this.ysCont.appendChild(ul);for (var w=0;w<3;w++){var li = document.createElement("LI");li.className = "dhtmlxcalendar_selector_cell";li._cell = true;ul.appendChild(li);}
 }
 
 this.ysCont.onclick = function(e) {e = e||event;e.cancelBubble = true;var t = (e.target||e.srcElement);if (t._year != null){that._hideSelector();that._drawMonth(new Date(t._year, that._activeMonth.getMonth(), 1, 0, 0, 0, 0));that._doOnSelectorChange();}
 }
 
 }
 
 
 if (type == "hours"){this._hsCells = {};this.hsCont = document.createElement("DIV");this.hsCont.className = "dhtmlxcalendar_area_"+css;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont);var i = 0;for (var q=0;q<4;q++){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_selector_line";this.hsCont.appendChild(ul);for (var w=0;w<6;w++){var li = document.createElement("LI");li.innerHTML = this._fixLength(i,2);li.className = "dhtmlxcalendar_selector_cell";ul.appendChild(li);li._hours = i;li._cell = true;this._hsCells[i++] = li;}
 }
 
 this.hsCont.onclick = function(e) {e = e||event;e.cancelBubble = true;var t = (e.target||e.srcElement);if (t._hours != null){that._hideSelector();that._activeDate.setHours(t._hours);that._updateActiveHours();that._updateVisibleHours();that._doOnSelectorChange();}
 }
 
 }
 
 
 if (type == "minutes"){this._rsCells = {};this.rsCont = document.createElement("DIV");this.rsCont.className = "dhtmlxcalendar_area_"+css;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont);var i = 0;for (var q=0;q<4;q++){var ul = document.createElement("UL");ul.className = "dhtmlxcalendar_selector_line";this.rsCont.appendChild(ul);for (var w=0;w<3;w++){var li = document.createElement("LI");li.innerHTML = this._fixLength(i,2);li.className = "dhtmlxcalendar_selector_cell";ul.appendChild(li);li._minutes = i;li._cell = true;this._rsCells[i] = li;i+=5;}
 }
 
 this.rsCont.onclick = function(e) {e = e||event;e.cancelBubble = true;var t = (e.target||e.srcElement);if (t._minutes != null){that._hideSelector();that._activeDate.setMinutes(t._minutes);that._updateActiveMinutes();that._updateVisibleMinutes();that._doOnSelectorChange();}
 }
 
 }
 
 
 this._sel._ta[type] = true;}
 
 this._showSelector = function(type,x,y,css,autoHide) {if (autoHide === true && this._sel != null && this._isSelectorVisible()&& type == this._sel._t) {this._hideSelector();return;}
 
 if (this.skin == "dhx_terrace"){x += {month: 14, year:27, hours: 19, minutes: 24}[type];y += {month: 8, year: 8, hours: 14, minutes: 14}[type];}
 
 if (!this._sel || !this._sel._ta[type])this._initSelector(type,css);this._selCover.style.display = "";this._sel._t = type;this._sel.style.left = x+"px";this._sel.style.top = y+"px";this._sel.style.display = "";this._sel.className = "dhtmlxcalendar_selector_obj dhtmlxcalendar_"+css;this._doOnSelectorShow(type);}
 
 this._doOnSelectorShow = function(type) {if (type == "month")this._updateActiveMonth();if (type == "year")this._updateYearsList(this._activeMonth);if (type == "hours")this._updateActiveHours();if (type == "minutes")this._updateActiveMinutes();}
 
 this._hideSelector = function() {if (!this._sel)return;this._sel.style.display = "none";this._selCover.style.display = "none";}
 
 this._isSelectorVisible = function() {if (!this._sel)return false;return (this._sel.style.display != "none");}
 
 this._doOnSelectorChange = function(state) {this.callEvent("onChange",[new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), this._activeDate.getDate(), this._activeDate.getHours(), this._activeDate.getMinutes(), this._activeDate.getSeconds()),state]);}
 
 this._clearSelHover = function() {if (!this._selHover)return;this._selHover.className = String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi,""));this._selHover = null;}
 
 
 
 
 this._updateActiveMonth = function() {if (typeof(this._msActive)!= "undefined" && typeof(this._msCells[this._msActive]) != "undefined") this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell";this._msActive = this._activeMonth.getMonth();this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active";}
 
 
 
 this._updateActiveYear = function() {var i = this._activeMonth.getFullYear();if (this._ysCells[i])this._ysCells[i].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active";}
 
 this._updateYearsList = function(d) {for (var a in this._ysCells){this._ysCells[a] = null;delete this._ysCells[a];}
 
 var i = 12*Math.floor(d.getFullYear()/12);for (var q=0;q<4;q++){for (var w=0;w<3;w++){this.ysCont.childNodes[q].childNodes[w].innerHTML = i;this.ysCont.childNodes[q].childNodes[w]._year = i;this.ysCont.childNodes[q].childNodes[w].className = "dhtmlxcalendar_selector_cell";this._ysCells[i++] = this.ysCont.childNodes[q].childNodes[w];}
 }
 this._updateActiveYear();}
 
 this._scrollYears = function(i) {var y = (i<0?this.ysCont.firstChild.firstChild._year:this.ysCont.lastChild.lastChild._year)+i;var d = new Date(y, this._activeMonth.getMonth(), 1, 0, 0, 0, 0);this._updateYearsList(d);}
 
 
 
 
 this._updateActiveHours = function() {if (typeof(this._hsActive)!= "undefined" && typeof(this._hsCells[this._hsActive]) != "undefined") this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell";this._hsActive = this._activeDate.getHours();this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active";}
 
 
 this._updateVisibleHours = function() {this.contTime.firstChild.firstChild.childNodes[1].innerHTML = this._fixLength(this._activeDate.getHours(),2);}
 
 
 
 
 this._updateActiveMinutes = function() {if (typeof(this._rsActive)!= "undefined" && typeof(this._rsCells[this._rsActive]) != "undefined") this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell";this._rsActive = this._activeDate.getMinutes();if (typeof(this._rsCells[this._rsActive])!= "undefined") this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active";}
 
 
 this._updateVisibleMinutes = function() {this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this._fixLength(this._activeDate.getMinutes(),2);}
 
 
 
 this._fixLength = function(t, r) {while (String(t).length < r) t = "0"+String(t);return t;}
 
 this._dateFormat = "";this._dateFormatRE = null;this.setDateFormat = function(format) {this._dateFormat = format;this._dateFormatRE = new RegExp(String(this._dateFormat).replace(/%[a-zA-Z]+/g,function(t){var t2 = t.replace(/%/,"");switch (t2) {case "n":
 case "j":
 case "g":
 case "G":
 return "\\d{1,2}";case "m":
 case "d":
 case "H":
 case "i":
 case "s":
 case "y":
 return "\\d{2}";case "Y":
 return "\\d{4}";case "M":
 return "("+that.langData[that.lang].monthesSNames.join("|").toLowerCase()+"){1,}";case "F":
 return "("+that.langData[that.lang].monthesFNames.join("|").toLowerCase()+"){1,}";}
 return t;}),"i");}
 
 this.setDateFormat("%Y-%m-%d");this._getInd = function(val,ar) {for (var q=0;q<ar.length;q++)if (ar[q].toLowerCase()== val) return q;return -1;}
 
 this._strToDate = function(val, format) {format = (format||this._dateFormat);var v = val.match(/[a-z0-9]{1,}/gi);var f = format.match(/%[a-zA-Z]/g);if (!v || v.length != f.length)return "Invalid Date";var p = {"%y":1,"%Y":1,"%n":2,"%m":2,"%M":2,"%F":2,"%d":3,"%j":3,"%H":4,"%G":4,"%h":4,"%g":4,"%i":5,"%s":6};var v2 = {};var f2 = {};for (var q=0;q<f.length;q++){if (typeof(p[f[q]])!= "undefined") {var ind = p[f[q]];if (!v2[ind]){v2[ind]=[];f2[ind]=[];}
 v2[ind].push(v[q]);f2[ind].push(f[q]);}
 }
 v = [];f = [];for (var q=1;q<=6;q++){if (v2[q] != null){for (var w=0;w<v2[q].length;w++){v.push(v2[q][w]);f.push(f2[q][w]);}
 }
 }
 
 
 var r = new Date();r.setDate(1);for (var q=0;q<v.length;q++){switch (f[q]) {case "%d":
 case "%j":
 case "%d":
 case "%j":
 case "%n":
 case "%m":
 case "%Y":
 case "%H":
 case "%G":
 case "%i":
 case "%s":
 if (!isNaN(v[q])) r[{"%d":"setDate","%j":"setDate","%n":"setMonth","%m":"setMonth","%Y":"setFullYear","%H":"setHours","%G":"setHours","%i":"setMinutes","%s":"setSeconds"}[f[q]]](Number(v[q])+(f[q]=="%m"||f[q]=="%n"?-1:0));break;case "%M":
 case "%F":
 var k = this._getInd(v[q].toLowerCase(),that.langData[that.lang][{"%M":"monthesSNames","%F":"monthesFNames"}[f[q]]]);if (k >= 0)r.setMonth(k);break;case "%y":
 if (!isNaN(v[q])) {var v0 = Number(v[q]);r.setFullYear(v0+(v0>50?1900:2000));}
 break;case "%g":
 case "%h":
 if (!isNaN(v[q])) {var v0 = Number(v[q]);if (v0 <= 12 && v0 >= 0)r.setHours(v0+(this._getInd("pm",v)>=0?12:0));}
 break;}
 
 }
 
 return r;}
 
 this._dateToStr = function(val, format) {if (val instanceof Date){var z = function(t) {return (String(t).length==1?"0"+String(t):t);}
 var k = function(t) {switch(t) {case "%d": return z(val.getDate());case "%j": return val.getDate();case "%D": return that.langData[that.lang].daysSNames[val.getDay()];case "%l": return that.langData[that.lang].daysFNames[val.getDay()];case "%m": return z(val.getMonth()+1);case "%n": return val.getMonth()+1;case "%M": return that.langData[that.lang].monthesSNames[val.getMonth()];case "%F": return that.langData[that.lang].monthesFNames[val.getMonth()];case "%y": return z(val.getYear()%100);case "%Y": return val.getFullYear();case "%g": return (val.getHours()+11)%12+1;case "%h": return z((val.getHours()+11)%12+1);case "%G": return val.getHours();case "%H": return z(val.getHours());case "%i": return z(val.getMinutes());case "%s": return z(val.getSeconds());case "%a": return (val.getHours()>11?"pm":"am");case "%A": return (val.getHours()>11?"PM":"AM");case "%%": "%";default: return t;}
 }
 var t = String(format||this._dateFormat).replace(/%[a-zA-Z]/g, k);}
 return (t||String(val));}
 
 this._updateDateStr = function(str) {if (str == ""){this.setDate(new Date());this.callEvent("onChange",[null,true]);return;}else {if (!this._dateFormatRE || !str.match(this._dateFormatRE)) return;}
 
 
 var r = this._strToDate(str);if (!(r instanceof Date)) return;this._nullDate = false;this._activeDate = r;this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleMinutes();this._updateVisibleHours();if (this._sel && this._isSelectorVisible()) this._doOnSelectorShow(this._sel._t);this._doOnSelectorChange(true);}
 
 this.setFormatedDate = function(format, str, a, return_only) {var date = this._strToDate(str, format);if (return_only)return date;this.setDate(date);}
 this.getFormatedDate = function(format, date) {if (this._nullDate)return "";if (!(date && date instanceof Date)) date = new Date(this._activeDate);return this._dateToStr(date, format);}
 
 
 
 
 
 this.show = function(id) {if (!id && this._hasParent){this._show();return;}
 
 
 if (typeof(id)== "object" && typeof(id._dhtmlxcalendar_uid) != "undefined" && this.i[id._dhtmlxcalendar_uid] == id) {this._show(id._dhtmlxcalendar_uid);return;}
 if (typeof(id)== "undefined") {for (var a in this.i)if (!id)id = a;}
 if (!id)return;this._show(id);}
 
 this.hide = function() {if (this._isVisible()) this._hide();}
 
 this.isVisible = function() {return this._isVisible();}
 
 
 this.draw = function() {this.show();}
 
 this.close = function() {this.hide();}
 
 
 
 this._activeInp = null;this.pos = "bottom";this.setPosition = function(x, y) {this._px = null;this._py = null;if (x == "right" || x == "bottom"){this.pos = x;}else {this.pos = "int";if (typeof(x)!= "undefined" && !isNaN(x)) {this.base.style.left = x+"px";this._px = x;}
 if (typeof(y)!= "undefined" && !isNaN(y)) {this.base.style.top = y+"px";this._py = y;}
 this._ifrSize();}
 }
 
 this._show = function(inpId, autoHide) {if (autoHide === true && this._activeInp == inpId && this._isVisible()) {this._hide();return;}
 if (!inpId){if (this._px && this._py){this.base.style.left = this._px+"px";this.base.style.top = this._py+"px";}else {this.base.style.left = "0px";this.base.style.top = "0px";}
 }else {if (this.pos == "right"){this.base.style.left = this._getLeft(this.i[inpId])+this.i[inpId].offsetWidth-1+"px";this.base.style.top = this._getTop(this.i[inpId])+"px";}else if (this.pos == "bottom"){this.base.style.left = this._getLeft(this.i[inpId])+"px";this.base.style.top = this._getTop(this.i[inpId])+this.i[inpId].offsetHeight-1+"px";}else {this.base.style.left = (this._px||0)+"px";this.base.style.top = (this._py||0)+"px";}
 this._activeInp = inpId;}
 this._hideSelector();this.base.style.display = "";this._ifrSize();if (this._ifr)this._ifr.style.display = "";}
 
 this._hide = function() {this._hideSelector();this.base.style.display = "none";this._activeInp = null;if (this._ifr)this._ifr.style.display = "none";}
 
 this._isVisible = function() {return (this.base.style.display!="none");}
 
 this._getLeft = function(obj) {return this._posGetOffset(obj).left;}
 
 this._getTop = function(obj) {return this._posGetOffset(obj).top;}
 
 this._posGetOffsetSum = function(elem) {var top=0, left=0;while(elem){top = top + parseInt(elem.offsetTop);left = left + parseInt(elem.offsetLeft);elem = elem.offsetParent;}
 return {top: top, left: left};}
 this._posGetOffsetRect = function(elem) {var box = elem.getBoundingClientRect();var body = document.body;var docElem = document.documentElement;var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;var clientTop = docElem.clientTop || body.clientTop || 0;var clientLeft = docElem.clientLeft || body.clientLeft || 0;var top = box.top + scrollTop - clientTop;var left = box.left + scrollLeft - clientLeft;return {top: Math.round(top), left: Math.round(left) };}
 this._posGetOffset = function(elem) {return this[elem.getBoundingClientRect?"_posGetOffsetRect":"_posGetOffsetSum"](elem);}
 
 this._rangeActive = false;this._rangeFrom = null;this._rangeTo = null;this._rangeSet = {};this.setInsensitiveDays = function(d) {var t = this._extractDates(d);for (var q=0;q<t.length;q++)this._rangeSet[new Date(t[q].getFullYear(),t[q].getMonth(),t[q].getDate(),0,0,0,0).getTime()] = true;this._drawMonth(this._activeMonth);}
 
 this.clearInsensitiveDays = function() {this._clearRangeSet();this._drawMonth(this._activeMonth);}
 
 this._holidays = {};this.setHolidays = function(r) {if (r == null){this._clearHolidays();}else if (r != null){var t = this._extractDates(r);for (var q=0;q<t.length;q++)this._holidays[new Date(t[q].getFullYear(),t[q].getMonth(),t[q].getDate(),0,0,0,0).getTime()] = true;}
 this._drawMonth(this._activeMonth);}
 
 this._extractDates = function(r) {if (typeof(r)== "string" || r instanceof Date) r = [r];var t = [];for (var q=0;q<r.length;q++){if (typeof(r[q])== "string") {var e = r[q].split(",");for (var w=0;w<e.length;w++)t.push(this._strToDate(e[w]));}else if (r[q] instanceof Date){t.push(r[q]);}
 }
 return t;}
 
 this._clearRange = function() {this._rangeActive = false;this._rangeType = null;this._rangeFrom = null;this._rangeTo = null;}
 
 this._clearRangeSet = function() {for (var a in this._rangeSet){this._rangeSet[a] = null;delete this._rangeSet[a];}
 }
 
 this._clearHolidays = function() {for (var a in this._holidays){this._holidays[a] = null;delete this._holidays[a];}
 }
 
 this._isOutOfRange = function(time) {if (this._rangeSet[time] == true)return true;if (this._rangeActive){if (this._rangeType == "in" && (time<this._rangeFrom || time>this._rangeTo)) return true;if (this._rangeType == "out" && (time>=this._rangeFrom && time<=this._rangeTo)) return true;if (this._rangeType == "from" && time<this._rangeFrom)return true;if (this._rangeType == "to" && time>this._rangeTo)return true;}
 
 var t0 = new Date(time);if (this._rangeWeek){if (this._rangeWeekData[t0.getDay()] === true) return true;}
 
 if (this._rangeMonth){if (this._rangeMonthData[t0.getDate()] === true) return true;}
 
 if (this._rangeYear){if (this._rangeYearData[t0.getMonth()+"_"+t0.getDate()] === true) return true;}
 
 return false;}
 
 this.clearSensitiveRange = function() {this._clearRange();this._drawMonth(this._activeMonth);}
 
 this.setSensitiveRange = function(from, to, ins) {var f = false;if (from != null && to != null){if (!(from instanceof Date)) from = this._strToDate(from);if (!(to instanceof Date)) to = this._strToDate(to);if (from.getTime()> to.getTime()) return;this._rangeFrom = new Date(from.getFullYear(),from.getMonth(),from.getDate(),0,0,0,0).getTime();this._rangeTo = new Date(to.getFullYear(),to.getMonth(),to.getDate(),0,0,0,0).getTime();this._rangeActive = true;this._rangeType = "in";f = true;}
 
 
 if (!f && from != null && to == null){if (!(from instanceof Date)) from = this._strToDate(from);this._rangeFrom = new Date(from.getFullYear(),from.getMonth(),from.getDate(),0,0,0,0).getTime();this._rangeTo = null;if (ins === true)this._rangeFrom++;this._rangeActive = true;this._rangeType = "from";f = true;}
 
 
 if (!f && from == null && to != null){if (!(to instanceof Date)) to = this._strToDate(to);this._rangeFrom = null;this._rangeTo = new Date(to.getFullYear(),to.getMonth(),to.getDate(),0,0,0,0).getTime();if (ins === true)this._rangeTo--;this._rangeActive = true;this._rangeType = "to";f = true;}
 
 if (f)this._drawMonth(this._activeMonth);}
 
 this.setInsensitiveRange = function(from, to) {if (from != null && to != null){if (!(from instanceof Date)) from = this._strToDate(from);if (!(to instanceof Date)) to = this._strToDate(to);if (from.getTime()> to.getTime()) return;this._rangeFrom = new Date(from.getFullYear(),from.getMonth(),from.getDate(),0,0,0,0).getTime();this._rangeTo = new Date(to.getFullYear(),to.getMonth(),to.getDate(),0,0,0,0).getTime();this._rangeActive = true;this._rangeType = "out";this._drawMonth(this._activeMonth);return;}
 
 if (from != null && to == null){this.setSensitiveRange(null, from, true);return;}
 
 if (from == null && to != null){this.setSensitiveRange(to, null, true);return;}
 
 }
 
 
 this.disableDays = function(mode, d) {if (mode == "week"){if (typeof(d)!= "object" && typeof(d.length) == "undefined") d = [d];if (!this._rangeWeekData)this._rangeWeekData = {};for (var a in this._rangeWeekData){this._rangeWeekData[a] = false;delete this._rangeWeekData[a];}
 
 for (var q=0;q<d.length;q++){this._rangeWeekData[d[q]] = true;if (d[q] == 7)this._rangeWeekData[0] = true;}
 this._rangeWeek = true;}
 
 if (mode == "month"){if (typeof(d)!= "object" && typeof(d.length) == "undefined") d = [d];if (!this._rangeMonthData)this._rangeMonthData = {};for (var a in this._rangeMonthData){this._rangeMonthData[a] = false;delete this._rangeMonthData[a];}
 for (var q=0;q<d.length;q++)this._rangeMonthData[d[q]] = true;this._rangeMonth = true;}
 
 if (mode == "year"){var t = this._extractDates(d);if (!this._rangeYearData)this._rangeYearData = {};for (var a in this._rangeYearData){this._rangeYearData[a] = false;delete this._rangeYearData[a];}
 for (var q=0;q<t.length;q++)this._rangeYearData[t[q].getMonth()+"_"+t[q].getDate()] = true;this._rangeYear = true;}
 
 this._drawMonth(this._activeMonth);}
 
 this.enableDays = function(mode) {if (mode == "week"){this._rangeWeek = false;}
 
 if (mode == "month"){this._rangeMonth = false;}
 
 if (mode == "year"){this._rangeYear = false;}
 
 this._drawMonth(this._activeMonth);}
 
 this._updateFromInput = function(t) {if (this._nullInInput && ((t.value).replace(/\s/g,"")).length == 0) {this.setDate(null);}else {this._updateDateStr(t.value);}
 t = null;}
 
 
 this._doOnClick = function(e) {e = e||event;var t = (e.target||e.srcElement);if (t._dhtmlxcalendar_uid && t._dhtmlxcalendar_uid != that._activeInp && that._isVisible()&&that._activeInp) {that._hide();return;}
 if (!t._dhtmlxcalendar_uid || !that.i[t._dhtmlxcalendar_uid]){if (that._isSelectorVisible()) that._hideSelector();else if (!that._hasParent && that._isVisible()) that._hide();}
 }
 
 this._doOnKeyDown = function(e) {e = e||event;if (e.keyCode == 27 || e.keyCode == 13){if (that._isSelectorVisible()) that._hideSelector();else if (that._isVisible()&& !that._hasParent) that._hide();}
 }
 
 
 this._doOnInpClick = function(e) {e = e||event;var t = (e.target||e.srcElement);if (!t._dhtmlxcalendar_uid)return;if (!that._listenerEnabled){that._updateFromInput(t);}
 that._show(t._dhtmlxcalendar_uid, true);}
 
 this._doOnInpKeyUp = function(e) {e = e||event;var t = (e.target||e.srcElement);if (e.keyCode == 13 || !t._dhtmlxcalendar_uid)return;if (!that._listenerEnabled)that._updateFromInput(t);}
 
 this._doOnUnload = function() {if (that && that.unload)that.unload();}
 
 if (window.addEventListener){document.body.addEventListener("click", that._doOnClick, false);window.addEventListener("keydown", that._doOnKeyDown, false);window.addEventListener("unload", that._doOnUnload, false);}else {document.body.attachEvent("onclick", that._doOnClick);document.body.attachEvent("onkeydown", that._doOnKeyDown);window.attachEvent("onunload", that._doOnUnload);}
 
 this.attachObj = function(obj) {if (typeof(obj)== "string") obj = document.getElementById(obj);var a = this.uid();this.i[a] = obj;this._attachEventsToObject(a);}
 
 this.detachObj = function(obj) {if (typeof(obj)== "string") obj = document.getElementById(obj);var a = obj._dhtmlxcalendar_uid;if (this.i[a] != null){this._detachEventsFromObject(a);this.i[a]._dhtmlxcalendar_uid = null;this.i[a] = null;delete this.i[a];}
 }
 
 this._attachEventsToObject = function(a) {this.i[a]._dhtmlxcalendar_uid = a;if (window.addEventListener){this.i[a].addEventListener("click", that._doOnInpClick, false);this.i[a].addEventListener("keyup", that._doOnInpKeyUp, false);}else {this.i[a].attachEvent("onclick", that._doOnInpClick);this.i[a].attachEvent("onkeyup", that._doOnInpKeyUp);}
 }
 
 
 this.enableListener = function(t) {if (window.addEventListener){t.addEventListener("focus", that._listenerEvFocus, false);t.addEventListener("blur", that._listenerEvBlur, false);}else {t.attachEvent("onfocus", that._listenerEvFocus);t.attachEvent("onblur", that._listenerEvBlur);}
 t = null;}
 
 this.disableListener = function(t) {t._f0 = false;if (this._tmListener)window.clearTimeout(this._tmListener);if (window.addEventListener){t.removeEventListener("focus", that._listenerEvFocus, false);t.removeEventListener("blur", that._listenerEvBlur, false);}else {t.detachEvent("onfocus", that._listenerEvFocus);t.detachEvent("onblur", that._listenerEvBlur);}
 t = null;}
 
 this._startListener = function(t) {if (this._tmListener)window.clearTimeout(this._tmListener);if (typeof(t._v1)== "undefined") t._v1 = t.value;if (t._v1 != t.value){this._updateFromInput(t);t._v1 = t.value;}
 if (t._f0)this._tmListener = window.setTimeout(function(){that._startListener(t);},100);}
 
 this._listenerEvFocus = function(e) {e = e||event;var t = e.target||e.srcElement;t._f0 = true;that._startListener(t)
 t = null;}
 this._listenerEvBlur = function(e) {e = e||event;var t = e.target||e.srcElement;t._f0 = false;t = null;}
 
 
 
 this._detachEventsFromObject = function(a) {if (window.addEventListener){this.i[a].removeEventListener("click", that._doOnInpClick, false);this.i[a].removeEventListener("keyup", that._doOnInpKeyUp, false);}else {this.i[a].detachEvent("onclick", that._doOnInpClick);this.i[a].detachEvent("onkeyup", that._doOnInpKeyUp);}
 }
 
 for (var a in this.i)this._attachEventsToObject(a);this.evs = {};this.attachEvent = function(name, func) {var eId = this.uid();this.evs[eId] = {name: String(name).toLowerCase(), func: func};return eId;}
 this.detachEvent = function(id) {if (this.evs[id]){this.evs[id].name = null;this.evs[id].func = null;this.evs[id] = null;delete this.evs[id];}
 }
 this.callEvent = function(name, params) {var u = true;var n = String(name).toLowerCase();params = (params||[]);for (var a in this.evs){if (this.evs[a].name == n){var r = this.evs[a].func.apply(this,params);u = (u && r);}
 }
 return u;}
 this.checkEvent = function(name) {var u = false;var n = String(name).toLowerCase();for (var a in this.evs)u = (u || this.evs[a].name == n);return u;}
 
 
 
 this.unload = function() {this._activeDate = null;this._activeDateCell = null;this._activeInp = null;this._activeMonth = null;this._dateFormat = null;this._dateFormatRE = null;this._lastHover = null;this.uid = null;this.uidd = null;if (this._tmListener)window.clearTimeout(this._tmListener);this._tmListener = null;if (window.addEventListener){document.body.removeEventListener("click", that._doOnClick, false);window.removeEventListener("keydown", that._doOnKeyDown, false);window.removeEventListener("unload", that._doOnUnload, false);}else {document.body.detachEvent("onclick", that._doOnClick);document.body.detachEvent("onkeydown", that._doOnKeyDown);window.detachEvent("onunload", that._doOnKeyDown);}
 
 this._doOnClick = null;this._doOnKeyDown = null;this._doOnUnload = null;for (var a in this.i){this.i[a]._dhtmlxcalendar_uid = null;if (window.addEventListener){this.i[a].removeEventListener("click", that._doOnInpClick, false);this.i[a].removeEventListener("keyup", that._doOnInpKeyUp, false);}else {this.i[a].detachEvent("onclick", that._doOnInpClick);this.i[a].detachEvent("onkeyup", that._doOnInpKeyUp);}
 
 this.disableListener(this.i[a]);this.i[a] = null;delete this.i[a];}
 
 this.i = null;this._doOnInpClick = null;this._doOnInpKeyUp = null;for (var a in this.evs)this.detachEvent(a);this.evs = null;this.attachEvent = null;this.detachEvent = null;this.checkEvent = null;this.callEvent = null;this.contMonth.onselectstart = null;this.contMonth.firstChild.firstChild.onclick = null;this.contMonth.firstChild.firstChild.firstChild.onmouseover = null;this.contMonth.firstChild.firstChild.firstChild.onmouseout = null;this.contMonth.firstChild.firstChild.lastChild.onmouseover = null;this.contMonth.firstChild.firstChild.lastChild.onmouseout = null;while (this.contMonth.firstChild.firstChild.childNodes.length > 0)this.contMonth.firstChild.firstChild.removeChild(this.contMonth.firstChild.firstChild.lastChild);this.contMonth.firstChild.removeChild(this.contMonth.firstChild.firstChild);this.contMonth.removeChild(this.contMonth.firstChild);this.contMonth.parentNode.removeChild(this.contMonth);this.contMonth = null;while (this.contDays.firstChild.childNodes.length > 0)this.contDays.firstChild.removeChild(this.contDays.firstChild.lastChild);this.contDays.removeChild(this.contDays.firstChild);this.contDays.parentNode.removeChild(this.contDays);this.contDays = null;this.contDates.onclick = null;this.contDates.onmouseover = null;this.contDates.onmouseout = null;while (this.contDates.childNodes.length > 0){while (this.contDates.lastChild.childNodes.length > 0){this.contDates.lastChild.lastChild._css_date = null;this.contDates.lastChild.lastChild._css_month = null;this.contDates.lastChild.lastChild._css_weekend = null;this.contDates.lastChild.lastChild._css_hover = null;this.contDates.lastChild.lastChild._date = null;this.contDates.lastChild.lastChild._q = null;this.contDates.lastChild.lastChild._w = null;this.contDates.lastChild.removeChild(this.contDates.lastChild.lastChild);}
 
 this.contDates.removeChild(this.contDates.lastChild);}
 
 
 this.contDates.parentNode.removeChild(this.contDates);this.contDates = null;this.contTime.firstChild.firstChild.onclick = null;while (this.contTime.firstChild.firstChild.childNodes.length > 0)this.contTime.firstChild.firstChild.removeChild(this.contTime.firstChild.firstChild.lastChild);this.contTime.firstChild.removeChild(this.contTime.firstChild.firstChild);this.contTime.removeChild(this.contTime.firstChild);this.contTime.parentNode.removeChild(this.contTime);this.contTime = null;this._lastHover = null;if (this.msCont){this.msCont.onclick = null;this._msActive = null;for (var a in this._msCells){this._msCells[a]._cell = null;this._msCells[a]._month = null;this._msCells[a].parentNode.removeChild(this._msCells[a]);this._msCells[a] = null;}
 this._msCells = null;while (this.msCont.childNodes.length > 0)this.msCont.removeChild(this.msCont.lastChild);this.msCont.parentNode.removeChild(this.msCont);this.msCont = null;}
 
 
 if (this.ysCont){this.ysCont.onclick = null;for (var a in this._ysCells){this._ysCells[a]._cell = null;this._ysCells[a]._year = null;this._ysCells[a].parentNode.removeChild(this._ysCells[a]);this._ysCells[a] = null;}
 this._ysCells = null;while (this.ysCont.childNodes.length > 0)this.ysCont.removeChild(this.ysCont.lastChild);this.ysCont.parentNode.removeChild(this.ysCont);this.ysCont = null;}
 
 
 if (this.hsCont){this.hsCont.onclick = null;this._hsActive = null;for (var a in this._hsCells){this._hsCells[a]._cell = null;this._hsCells[a]._hours = null;this._hsCells[a].parentNode.removeChild(this._hsCells[a]);this._hsCells[a] = null;}
 this._hsCells = null;while (this.hsCont.childNodes.length > 0)this.hsCont.removeChild(this.hsCont.lastChild);this.hsCont.parentNode.removeChild(this.hsCont);this.hsCont = null;}
 
 
 if (this.rsCont){this.rsCont.onclick = null;this._rsActive = null;for (var a in this._rsCells){this._rsCells[a]._cell = null;this._rsCells[a]._minutes = null;this._rsCells[a].parentNode.removeChild(this._rsCells[a]);this._rsCells[a] = null;}
 this._rsCells = null;while (this.rsCont.childNodes.length > 0)this.rsCont.removeChild(this.rsCont.lastChild);this.rsCont.parentNode.removeChild(this.rsCont);this.rsCont = null;}
 
 
 if (this._selCover){this._selCover.parentNode.removeChild(this._selCover);this._selCover = null;}
 
 
 if (this._sel){for (var a in this._sel._ta)this._sel._ta[a] = null;this._sel._ta = null;this._sel._t = null;this._sel.onmouseover = null;this._sel.onmouseout = null;while (this._sel.firstChild.firstChild.firstChild.childNodes.length > 0){this._sel.firstChild.firstChild.firstChild.lastChild.onclick = null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseover = null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseout = null;this._sel.firstChild.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild.lastChild);}
 
 
 this._sel.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild);this._sel.firstChild.removeChild(this._sel.firstChild.firstChild);while (this._sel.childNodes.length > 0)this._sel.removeChild(this._sel.lastChild);this._sel.parentNode.removeChild(this._sel);this._sel = null;}
 
 
 
 
 this.base.onclick = null;this.base.parentNode.removeChild(this.base);this.base = null;this._clearDayHover = null;this._clearSelHover = null;this._doOnSelectorChange = null;this._doOnSelectorShow = null;this._drawMonth = null;this._fixLength = null;this._getLeft = null;this._getTop = null;this._ifrSize = null;this._hide = null;this._hideSelector = null;this._initSelector = null;this._isSelectorVisible = null;this._isVisible = null;this._posGetOffset = null;this._posGetOffsetRect = null;this._posGetOffsetSum = null;this._scrollYears = null;this._show = null;this._showSelector = null;this._strToDate = null;this._updateActiveHours = null;this._updateActiveMinutes = null;this._updateActiveMonth = null;this._updateActiveYear = null;this._updateCellStyle = null;this._updateDateStr = null;this._updateVisibleHours = null;this._updateVisibleMinutes = null;this._updateYearsList = null;this.enableIframe = null;this.hide = null;this.hideTime = null;this.setDate = null;this.setDateFormat = null;this.setYearsRange = null;this.show = null;this.showTime = null;this.unload = null;for (var a in this)delete this[a];a = that = null;}
 
 
 
 this.setDate(this._activeDate);return this;};dhtmlXCalendarObject.prototype.setYearsRange = function(){};dhtmlXCalendarObject.prototype.lang = "en";dhtmlXCalendarObject.prototype.langData = {"en": {dateformat: "%Y-%m-%d",
 monthesFNames: ["January","February","March","April","May","June","July","August","September","October","November","December"],
 monthesSNames: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
 daysFNames: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
 daysSNames: ["Su","Mo","Tu","We","Th","Fr","Sa"],
 weekstart: 1
 }
};dhtmlXCalendarObject.prototype.enableIframe = function(mode) {if (mode == true){if (!this._ifr){this._ifr = document.createElement("IFRAME");this._ifr.frameBorder = 0;this._ifr.border = 0;this._ifr.setAttribute("src","javascript:false;");this._ifr.className = "dhtmlxcalendar_ifr";this._ifr.onload = function(){this.onload = null;this.contentWindow.document.open("text/html", "replace");this.contentWindow.document.write("<html><head><style>html,body{width:100%;height:100%;overflow:hidden;margin:0px;}</style></head><body</body></html>");}
 this.base.parentNode.insertBefore(this._ifr, this.base);this._ifrSize();}
 }else {if (this._ifr){this._ifr.parentNode.removeChild(this._ifr);this._ifr = null;}
 }
};dhtmlXCalendarObject.prototype._ifrSize = function() {if (this._ifr){this._ifr.style.left = this.base.style.left;this._ifr.style.top = this.base.style.top;this._ifr.style.width = this.base.offsetWidth+"px";this._ifr.style.height = this.base.offsetHeight+"px";}
};dhtmlxCalendarObject = dhtmlXCalendarObject;if (!window.dhtmlx)dhtmlx={};dhtmlx.assert = function(test, message){if (!test)dhtmlx.error(message);};dhtmlx.assert_enabled=function(){return false;};dhtmlx.assert_event = function(obj, evs){if (!obj._event_check){obj._event_check = {};obj._event_check_size = {};}
 
 for (var a in evs){obj._event_check[a.toLowerCase()]=evs[a];var count=-1;for (var t in evs[a])count++;obj._event_check_size[a.toLowerCase()]=count;}
};dhtmlx.assert_method_info=function(obj, name, descr, rules){var args = [];for (var i=0;i < rules.length;i++){args.push(rules[i][0]+" : "+rules[i][1]+"\n "+rules[i][2].describe()+(rules[i][3]?";optional":""));}
 return obj.name+"."+name+"\n"+descr+"\n Arguments:\n - "+args.join("\n - ");};dhtmlx.assert_method = function(obj, config){for (var key in config)dhtmlx.assert_method_process(obj, key, config[key].descr, config[key].args, (config[key].min||99), config[key].skip);};dhtmlx.assert_method_process = function (obj, name, descr, rules, min, skip){var old = obj[name];if (!skip)obj[name] = function(){if (arguments.length != rules.length && arguments.length < min)dhtmlx.log("warn","Incorrect count of parameters\n"+obj[name].describe()+"\n\nExpecting "+rules.length+" but have only "+arguments.length);else
 for (var i=0;i<rules.length;i++)if (!rules[i][3] && !rules[i][2](arguments[i]))
 dhtmlx.log("warn","Incorrect method call\n"+obj[name].describe()+"\n\nActual value of "+(i+1)+" parameter: {"+(typeof arguments[i])+"}"+arguments[i]);return old.apply(this, arguments);};obj[name].describe = function(){return dhtmlx.assert_method_info(obj, name, descr, rules);};};dhtmlx.assert_event_call = function(obj, name, args){if (obj._event_check){if (!obj._event_check[name])dhtmlx.log("warn","Not expected event call :"+name);else if (dhtmlx.isNotDefined(args))
 dhtmlx.log("warn","Event without parameters :"+name);else if (obj._event_check_size[name] != args.length)dhtmlx.log("warn","Incorrect event call, expected "+obj._event_check_size[name]+" parameter(s), but have "+args.length +" parameter(s), for "+name+" event");}
};dhtmlx.assert_event_attach = function(obj, name){if (obj._event_check && !obj._event_check[name])dhtmlx.log("warn","Unknown event name: "+name);};dhtmlx.assert_property = function(obj, evs){if (!obj._settings_check)obj._settings_check={};dhtmlx.extend(obj._settings_check, evs);};dhtmlx.assert_check = function(data,coll){if (typeof data == "object"){for (var key in data){dhtmlx.assert_settings(key,data[key],coll);}
 }
};dhtmlx.assert_settings = function(mode,value,coll){coll = coll || this._settings_check;if (coll){if (!coll[mode])return dhtmlx.log("warn","Unknown propery: "+mode);var descr = "";var error = "";var check = false;for (var i=0;i<coll[mode].length;i++){var rule = coll[mode][i];if (typeof rule == "string")continue;if (typeof rule == "function")check = check || rule(value);else if (typeof rule == "object" && typeof rule[1] == "function"){check = check || rule[1](value);if (check && rule[2])dhtmlx["assert_check"](value, rule[2]);}
 if (check)break;}
 if (!check )dhtmlx.log("warn","Invalid configuration\n"+dhtmlx.assert_info(mode,coll)+"\nActual value: {"+(typeof value)+"}"+value);}
};dhtmlx.assert_info=function(name, set){var ruleset = set[name];var descr = "";var expected = [];for (var i=0;i<ruleset.length;i++){if (typeof rule == "string")descr = ruleset[i];else if (ruleset[i].describe)expected.push(ruleset[i].describe());else if (ruleset[i][1] && ruleset[i][1].describe)expected.push(ruleset[i][1].describe());}
 return "Property: "+name+", "+descr+" \nExpected value: \n - "+expected.join("\n - ");};if (dhtmlx.assert_enabled()){dhtmlx.assert_rule_color=function(check){if (typeof check != "string")return false;if (check.indexOf("#")!==0) return false;if (check.substr(1).replace(/[0-9A-F]/gi,"")!=="") return false;return true;};dhtmlx.assert_rule_color.describe = function(){return "{String}Value must start from # and contain hexadecimal code of color";};dhtmlx.assert_rule_template=function(check){if (typeof check == "function")return true;if (typeof check == "string")return true;return false;};dhtmlx.assert_rule_template.describe = function(){return "{Function},{String}Value must be a function which accepts data object and return text string, or a sting with optional template markers";};dhtmlx.assert_rule_boolean=function(check){if (typeof check == "boolean")return true;return false;};dhtmlx.assert_rule_boolean.describe = function(){return "{Boolean}true or false";};dhtmlx.assert_rule_object=function(check, sub){if (typeof check == "object")return true;return false;};dhtmlx.assert_rule_object.describe = function(){return "{Object}Configuration object";};dhtmlx.assert_rule_string=function(check){if (typeof check == "string")return true;return false;};dhtmlx.assert_rule_string.describe = function(){return "{String}Plain string";};dhtmlx.assert_rule_htmlpt=function(check){return !!dhtmlx.toNode(check);};dhtmlx.assert_rule_htmlpt.describe = function(){return "{Object},{String}HTML node or ID of HTML Node";};dhtmlx.assert_rule_notdocumented=function(check){return false;};dhtmlx.assert_rule_notdocumented.describe = function(){return "This options wasn't documented";};dhtmlx.assert_rule_key=function(obj){var t = function (check){return obj[check];};t.describe=function(){var opts = [];for(var key in obj)opts.push(key);return "{String}can take one of next values: "+opts.join(", ");};return t;};dhtmlx.assert_rule_dimension=function(check){if (check*1 == check && !isNaN(check)&& check >= 0) return true;return false;};dhtmlx.assert_rule_dimension.describe=function(){return "{Integer}value must be a positive number";};dhtmlx.assert_rule_number=function(check){if (typeof check == "number")return true;return false;};dhtmlx.assert_rule_number.describe=function(){return "{Integer}value must be a number";};dhtmlx.assert_rule_function=function(check){if (typeof check == "function")return true;return false;};dhtmlx.assert_rule_function.describe=function(){return "{Function}value must be a custom function";};dhtmlx.assert_rule_any=function(check){return true;};dhtmlx.assert_rule_any.describe=function(){return "Any value";};dhtmlx.assert_rule_mix=function(a,b){var t = function(check){if (a(check)||b(check)) return true;return false;};t.describe = function(){return a.describe();};return t;};}
dhtmlx.version="3.0";dhtmlx.codebase="./";dhtmlx.copy = function(source){var f = dhtmlx.copy._function;f.prototype = source;return new f();};dhtmlx.copy._function = function(){};dhtmlx.extend = function(target, source){for (var method in source)target[method] = source[method];if (dhtmlx.assert_enabled()&& source._assert){target._assert();target._assert=null;}
 
 dhtmlx.assert(target,"Invalid nesting target");dhtmlx.assert(source,"Invalid nesting source");if (source._init)target._init();return target;};dhtmlx.proto_extend = function(){var origins = arguments;var compilation = origins[0];var construct = [];for (var i=origins.length-1;i>0;i--){if (typeof origins[i]== "function")origins[i]=origins[i].prototype;for (var key in origins[i]){if (key == "_init")construct.push(origins[i][key]);else if (!compilation[key])compilation[key] = origins[i][key];}
 };if (origins[0]._init)construct.push(origins[0]._init);compilation._init = function(){for (var i=0;i<construct.length;i++)construct[i].apply(this, arguments);};compilation.base = origins[1];var result = function(config){this._init(config);if (this._parseSettings)this._parseSettings(config, this.defaults);};result.prototype = compilation;compilation = origins = null;return result;};dhtmlx.bind=function(functor, object){return function(){return functor.apply(object,arguments);};};dhtmlx.require=function(module){if (!dhtmlx._modules[module]){dhtmlx.assert(dhtmlx.ajax,"load module is required");dhtmlx.exec( dhtmlx.ajax().sync().get(dhtmlx.codebase+module).responseText );dhtmlx._modules[module]=true;}
};dhtmlx._modules = {};dhtmlx.exec=function(code){if (window.execScript)window.execScript(code);else window.eval(code);};dhtmlx.methodPush=function(object,method,event){return function(){var res = false;res=object[method].apply(object,arguments);return res;};};dhtmlx.isNotDefined=function(a){return typeof a == "undefined";};dhtmlx.delay=function(method, obj, params, delay){setTimeout(function(){var ret = method.apply(obj,params);method = obj = params = null;return ret;},delay||1);};dhtmlx.uid = function(){if (!this._seed)this._seed=(new Date).valueOf();this._seed++;return this._seed;};dhtmlx.toNode = function(node){if (typeof node == "string")return document.getElementById(node);return node;};dhtmlx.toArray = function(array){return dhtmlx.extend((array||[]),dhtmlx.PowerArray);};dhtmlx.toFunctor=function(str){return (typeof(str)=="string") ? eval(str) : str;};dhtmlx._events = {};dhtmlx.event=function(node,event,handler,master){node = dhtmlx.toNode(node);var id = dhtmlx.uid();dhtmlx._events[id]=[node,event,handler];if (master)handler=dhtmlx.bind(handler,master);if (node.addEventListener)node.addEventListener(event, handler, false);else if (node.attachEvent)node.attachEvent("on"+event, handler);return id;};dhtmlx.eventRemove=function(id){if (!id)return;dhtmlx.assert(this._events[id],"Removing non-existing event");var ev = dhtmlx._events[id];if (ev[0].removeEventListener)ev[0].removeEventListener(ev[1],ev[2],false);else if (ev[0].detachEvent)ev[0].detachEvent("on"+ev[1],ev[2]);delete this._events[id];};dhtmlx.log = function(type,message,details){if (window.console && console.log){type=type.toLowerCase();if (window.console[type])window.console[type](message||"unknown error");else
 window.console.log(type +": "+message);if (details)window.console.log(details);}
};dhtmlx.log_full_time = function(name){dhtmlx._start_time_log = new Date();dhtmlx.log("Info","Timing start ["+name+"]");window.setTimeout(function(){var time = new Date();dhtmlx.log("Info","Timing end ["+name+"]:"+(time.valueOf()-dhtmlx._start_time_log.valueOf())/1000+"s");},1);};dhtmlx.log_time = function(name){var fname = "_start_time_log"+name;if (!dhtmlx[fname]){dhtmlx[fname] = new Date();dhtmlx.log("Info","Timing start ["+name+"]");}else {var time = new Date();dhtmlx.log("Info","Timing end ["+name+"]:"+(time.valueOf()-dhtmlx[fname].valueOf())/1000+"s");dhtmlx[fname] = null;}
};dhtmlx.error = function(message,details){dhtmlx.log("error",message,details);};dhtmlx.EventSystem={_init:function(){this._events = {};this._handlers = {};this._map = {};},
 
 block : function(){this._events._block = true;},
 
 unblock : function(){this._events._block = false;},
 mapEvent:function(map){dhtmlx.extend(this._map, map);},
 
 callEvent:function(type,params){if (this._events._block)return true;type = type.toLowerCase();dhtmlx.assert_event_call(this, type, params);var event_stack =this._events[type.toLowerCase()];var return_value = true;if (dhtmlx.debug)dhtmlx.log("info","["+this.name+"] event:"+type,params);if (event_stack)for(var i=0;i<event_stack.length;i++)if (event_stack[i].apply(this,(params||[]))===false) return_value=false;if (this._map[type] && !this._map[type].callEvent(type,params))
 return_value = false;return return_value;},
 
 attachEvent:function(type,functor,id){type=type.toLowerCase();dhtmlx.assert_event_attach(this, type);id=id||dhtmlx.uid();functor = dhtmlx.toFunctor(functor);var event_stack=this._events[type]||dhtmlx.toArray();event_stack.push(functor);this._events[type]=event_stack;this._handlers[id]={f:functor,t:type };return id;},
 
 detachEvent:function(id){if(this._handlers[id]){var type=this._handlers[id].t;var functor=this._handlers[id].f;var event_stack=this._events[type];event_stack.remove(functor);delete this._handlers[id];}
 }
};dhtmlx.PowerArray={removeAt:function(pos,len){if (pos>=0)this.splice(pos,(len||1));},
 
 remove:function(value){this.removeAt(this.find(value));}, 
 
 insertAt:function(data,pos){if (!pos && pos!==0)this.push(data);else {var b = this.splice(pos,(this.length-pos));this[pos] = data;this.push.apply(this,b);}
 }, 
 
 find:function(data){for (i=0;i<this.length;i++)if (data==this[i])return i;return -1;},
 
 each:function(functor,master){for (var i=0;i < this.length;i++)functor.call((master||this),this[i]);},
 
 map:function(functor,master){for (var i=0;i < this.length;i++)this[i]=functor.call((master||this),this[i]);return this;}
};dhtmlx.env = {};if (navigator.userAgent.indexOf('Opera')!= -1)
 dhtmlx._isOpera=true;else{dhtmlx._isIE=!!document.all;dhtmlx._isFF=!document.all;dhtmlx._isWebKit=(navigator.userAgent.indexOf("KHTML")!=-1);if (navigator.appVersion.indexOf("MSIE 8.0")!= -1 && document.compatMode != "BackCompat") 
 dhtmlx._isIE=8;if (navigator.appVersion.indexOf("MSIE 9.0")!= -1 && document.compatMode != "BackCompat") 
 dhtmlx._isIE=9;}
dhtmlx.env = {};(function(){dhtmlx.env.transform = false;dhtmlx.env.transition = false;var options = {};options.names = ['transform', 'transition'];options.transform = ['transform', 'WebkitTransform', 'MozTransform', 'oTransform','msTransform'];options.transition = ['transition', 'WebkitTransition', 'MozTransition', 'oTransition'];var d = document.createElement("DIV");var property;for(var i=0;i<options.names.length;i++){while (p = options[options.names[i]].pop()) {if(typeof d.style[p] != 'undefined')dhtmlx.env[options.names[i]] = true;}
 }
})();dhtmlx.env.transform_prefix = (function(){var prefix;if(dhtmlx._isOpera)prefix = '-o-';else {prefix = '';if(dhtmlx._isFF)prefix = '-moz-';if(dhtmlx._isWebKit)prefix = '-webkit-';}
 return prefix;})();dhtmlx.env.svg = (function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");})();dhtmlx.zIndex={drag : 10000 };dhtmlx.html={create:function(name,attrs,html){attrs = attrs || {};var node = document.createElement(name);for (var attr_name in attrs)node.setAttribute(attr_name, attrs[attr_name]);if (attrs.style)node.style.cssText = attrs.style;if (attrs["class"])node.className = attrs["class"];if (html)node.innerHTML=html;return node;},
 
 getValue:function(node){node = dhtmlx.toNode(node);if (!node)return "";return dhtmlx.isNotDefined(node.value)?node.innerHTML:node.value;},
 
 remove:function(node){if (node instanceof Array)for (var i=0;i < node.length;i++)this.remove(node[i]);else
 if (node && node.parentNode)node.parentNode.removeChild(node);},
 
 insertBefore: function(node,before,rescue){if (!node)return;if (before)before.parentNode.insertBefore(node, before);else
 rescue.appendChild(node);},
 
 
 locate:function(e,id){e=e||event;var trg=e.target||e.srcElement;while (trg){if (trg.getAttribute){var test = trg.getAttribute(id);if (test)return test;}
 trg=trg.parentNode;}
 return null;},
 
 offset:function(elem) {if (elem.getBoundingClientRect){var box = elem.getBoundingClientRect();var body = document.body;var docElem = document.documentElement;var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;var clientTop = docElem.clientTop || body.clientTop || 0;var clientLeft = docElem.clientLeft || body.clientLeft || 0;var top = box.top + scrollTop - clientTop;var left = box.left + scrollLeft - clientLeft;return {y: Math.round(top), x: Math.round(left) };}else {var top=0, left=0;while(elem){top = top + parseInt(elem.offsetTop,10);left = left + parseInt(elem.offsetLeft,10);elem = elem.offsetParent;}
 return {y: top, x: left};}
 },
 
 pos:function(ev){ev = ev || event;if(ev.pageX || ev.pageY)return {x:ev.pageX, y:ev.pageY};var d = ((dhtmlx._isIE)&&(document.compatMode != "BackCompat"))?document.documentElement:document.body;return {x:ev.clientX + d.scrollLeft - d.clientLeft,
 y:ev.clientY + d.scrollTop - d.clientTop
 };},
 
 preventEvent:function(e){if (e && e.preventDefault)e.preventDefault();dhtmlx.html.stopEvent(e);},
 
 stopEvent:function(e){(e||event).cancelBubble=true;return false;},
 
 addCss:function(node,name){node.className+=" "+name;},
 
 removeCss:function(node,name){node.className=node.className.replace(RegExp(name,"g"),"");}
};(function(){var temp = document.getElementsByTagName("SCRIPT");dhtmlx.assert(temp.length,"Can't locate codebase");if (temp.length){temp = (temp[temp.length-1].getAttribute("src")||"").split("/");temp.splice(temp.length-1, 1);dhtmlx.codebase = temp.slice(0, temp.length).join("/")+"/";}
})();if (!dhtmlx.ui)dhtmlx.ui={};dhtmlx.Destruction = {_init:function(){dhtmlx.destructors.push(this);},
 
 
 destructor:function(){this.destructor=function(){};this._htmlmap = null;this._htmlrows = null;if (this._html)document.body.appendChild(this._html);this._html = null;if (this._obj){this._obj.innerHTML="";this._obj._htmlmap = null;}
 this._obj = this._dataobj=null;this.data = null;this._events = this._handlers = {};}
};dhtmlx.destructors = [];dhtmlx.event(window,"unload",function(){for (var i=0;i<dhtmlx.destructors.length;i++)dhtmlx.destructors[i].destructor();dhtmlx.destructors = [];for (var a in dhtmlx._events){var ev = dhtmlx._events[a];if (ev[0].removeEventListener)ev[0].removeEventListener(ev[1],ev[2],false);else if (ev[0].detachEvent)ev[0].detachEvent("on"+ev[1],ev[2]);delete dhtmlx._events[a];}
});dhtmlx.math = {};dhtmlx.math._toHex=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];dhtmlx.math.toHex = function(number, length){number=parseInt(number,10);str = "";while (number>0){str=this._toHex[number%16]+str;number=Math.floor(number/16);}
 while (str.length <length)str = "0"+str;return str;};dhtmlx.math.hexToDec = function(hex){return parseInt(hex, 16);};dhtmlx.math.toRgb = function(rgb){var r,g,b,rgbArr;if (typeof(rgb)!= 'string') {r = rgb[0];g = rgb[1];b = rgb[2];}else if (rgb.indexOf('rgb')!=-1) {rgbArr = rgb.substr(rgb.indexOf("(")+1,rgb.lastIndexOf(")")-rgb.indexOf("(")-1).split(",");r = rgbArr[0];g = rgbArr[1];b = rgbArr[2];}else {if (rgb.substr(0, 1)== '#') {rgb = rgb.substr(1);}
 r = this.hexToDec(rgb.substr(0, 2));g = this.hexToDec(rgb.substr(2, 2));b = this.hexToDec(rgb.substr(4, 2));}
 r = (parseInt(r,10)||0);g = (parseInt(g,10)||0);b = (parseInt(b,10)||0);if (r < 0 || r > 255)r = 0;if (g < 0 || g > 255)g = 0;if (b < 0 || b > 255)b = 0;return [r,g,b];}
dhtmlx.math.hsvToRgb = function(h, s, v){var hi,f,p,q,t,r,g,b;hi = Math.floor((h/60))%6;f = h/60-hi;p = v*(1-s);q = v*(1-f*s);t = v*(1-(1-f)*s);r = 0;g = 0;b = 0;switch(hi) {case 0:
 r = v;g = t;b = p;break;case 1:
 r = q;g = v;b = p;break;case 2:
 r = p;g = v;b = t;break;case 3:
 r = p;g = q;b = v;break;case 4:
 r = t;g = p;b = v;break;case 5:
 r = v;g = p;b = q;break;}
 r = Math.floor(r*255);g = Math.floor(g*255);b = Math.floor(b*255);return [r, g, b];};dhtmlx.math.rgbToHsv = function(r, g, b){var r0,g0,b0,min0,max0,s,h,v;r0 = r/255;g0 = g/255;b0 = b/255;var min0 = Math.min(r0, g0, b0);var max0 = Math.max(r0, g0, b0);h = 0;s = max0==0?0:(1-min0/max0);v = max0;if (max0 == min0){h = 0;}else if (max0 == r0 && g0>=b0){h = 60*(g0 - b0)/(max0 - min0)+0;}else if (max0 == r0 && g0 < b0){h = 60*(g0 - b0)/(max0 - min0)+360;}else if (max0 == g0){h = 60*(b0 - r0)/(max0-min0)+120;}else if (max0 == b0){h = 60*(r0 - g0)/(max0 - min0)+240;}
 return [h, s, v];}
if(!dhtmlx.presets)dhtmlx.presets = {};dhtmlx.presets.chart = {"simple":{item:{borderColor: "#ffffff",
 color: "#2b7100",
 shadow: false,
 borderWidth:2
 },
 line:{color:"#8ecf03",
 width:2
 }
 },
 "plot":{color:"#1293f8",
 item:{borderColor:"#636363",
 borderWidth:1,
 color: "#ffffff",
 type:"r",
 shadow: false
 },
 line:{color:"#1293f8",
 width:2
 }
 },
 "diamond":{color:"#b64040",
 item:{borderColor:"#b64040",
 color: "#b64040",
 type:"d",
 radius:3,
 shadow:true
 },
 line:{color:"#ff9000",
 width:2
 }
 },
 "point":{color:"#fe5916",
 disableLines:true,
 fill:false,
 disableItems:false,
 item:{color:"#feb916",
 borderColor:"#fe5916",
 radius:2,
 borderWidth:1,
 type:"r"
 },
 alpha:1
 },
 "line":{line:{color:"#3399ff",
 width:2
 },
 item:{color:"#ffffff",
 borderColor:"#3399ff",
 radius:2,
 borderWidth:2,
 type:"d"
 },
 fill:false,
 disableItems:false,
 disableLines:false,
 alpha:1
 },
 "area":{fill:"#3399ff",
 line:{color:"#3399ff",
 width:1
 },
 disableItems:true,
 alpha: 0.2,
 disableLines:false
 },
 "round":{item:{radius:3,
 borderColor:"#3f83ff",
 borderWidth:1,
 color:"#3f83ff",
 type:"r",
 shadow:false,
 alpha:0.6
 }
 },
 "square":{item:{radius:3,
 borderColor:"#447900",
 borderWidth:2,
 color:"#69ba00",
 type:"s",
 shadow:false,
 alpha:1
 }
 },
 
 "column":{color:"RAINBOW",
 gradient:false,
 width:45,
 radius:0,
 alpha:1,
 border:true
 },
 "stick":{width:5,
 gradient:false,
 color:"#67b5c9",
 radius:2,
 alpha:1,
 border:false
 },
 "alpha":{color:"#b9a8f9",
 width:70,
 gradient:"falling",
 radius:0,
 alpha:0.5,
 border:true
 }
};dhtmlx.ui.Map = function(key){this.name = "Map";this._id = "map_"+dhtmlx.uid();this._key = key;this._map = [];};dhtmlx.ui.Map.prototype = {addRect: function(id,points,userdata) {this._createMapArea(id,"RECT",points,userdata);},
 addPoly: function(id,points) {this._createMapArea(id,"POLY",points);},
 _createMapArea:function(id,shape,coords,userdata){var extra_data = "";if(arguments.length==4)extra_data = "userdata='"+userdata+"'";this._map.push("<area "+this._key+"='"+id+"' shape='"+shape+"' coords='"+coords.join()+"' "+extra_data+"></area>");},
 addSector:function(id,alpha0,alpha1,x,y,R,ky){var points = [];points.push(x);points.push(Math.floor(y*ky));for(var i = alpha0;i < alpha1;i+=Math.PI/18){points.push(Math.floor(x+R*Math.cos(i)));points.push(Math.floor((y+R*Math.sin(i))*ky));}
 points.push(Math.floor(x+R*Math.cos(alpha1)));points.push(Math.floor((y+R*Math.sin(alpha1))*ky));points.push(x);points.push(Math.floor(y*ky));return this.addPoly(id,points);},
 render:function(obj){var d = dhtmlx.html.create("DIV");d.style.cssText="position:absolute;width:100%;height:100%;top:0px;left:0px;";obj.appendChild(d);var src = dhtmlx._isIE?"":"src=''";d.innerHTML="<map id='"+this._id+"' name='"+this._id+"'>"+this._map.join("\n")+"</map><img "+src+" class='dhx_map_img' usemap='#"+this._id+"'>";obj._htmlmap = d;this._map = [];}
};dhtmlx.chart = {};dhtmlx.chart.scatter = {pvt_render_scatter:function(ctx, data, point0, point1, sIndex, map){if(!this._settings.xValue)return dhtmlx.log("warning","Undefined propery: xValue");var limitsY = this._getLimits();var limitsX = this._getLimits("h","xValue");if(!sIndex){this._drawYAxis(ctx,data,point0,point1,limitsY.min,limitsY.max);this._drawHXAxis(ctx,data,point0,point1,limitsX.min,limitsX.max);}
 limitsY = {min:this._settings.yAxis.start,max:this._settings.yAxis.end};limitsX = {min:this._settings.xAxis.start,max:this._settings.xAxis.end};var params = this._getScatterParams(ctx,data,point0,point1,limitsX,limitsY);for(var i=0;i<data.length;i++){this._drawScatterItem(ctx,map,point0, point1, params,limitsX,limitsY,data[i],sIndex);}
 },
 _getScatterParams:function(ctx, data, point0, point1,limitsX,limitsY){var params = {};params.totalHeight = point1.y-point0.y;params.totalWidth = point1.x-point0.x;this._calcScatterUnit(params,limitsX.min,limitsX.max,params.totalWidth,"X");this._calcScatterUnit(params,limitsY.min,limitsY.max,params.totalHeight,"Y");return params;},
 _drawScatterItem:function(ctx,map,point0, point1,params,limitsX,limitsY,obj,sIndex){var x0 = this._calculateScatterItemPosition(params, point1, point0, limitsX, obj, "X");var y0 = this._calculateScatterItemPosition(params, point0, point1, limitsY, obj, "Y");this. _drawItemOfLineChart(ctx,x0,y0,obj,1);var config = this._settings;var areaWidth = (config.eventRadius||Math.floor(config.item.radius+1));map.addRect(obj.id,[x0-areaWidth,y0-areaWidth,x0+areaWidth,y0+areaWidth],sIndex);},
 _calculateScatterItemPosition:function(params, point0, point1, limits, obj, axis){var value = this._settings[axis=="X"?"xValue":"value"].call(this,obj);var valueFactor = params["valueFactor"+axis];var v = (parseFloat(value||0) - limits.min)*valueFactor;var unit = params["unit"+axis];var pos = point1[axis.toLowerCase()] - (axis=="X"?(-1):1)*Math.floor(unit*v);if(v<0)pos = point1[axis.toLowerCase()];if(value > limits.max)pos = point0[axis.toLowerCase()];if(value < limits.min)pos = point1[axis.toLowerCase()];return pos;},
 _calcScatterUnit:function(p,min,max,size,axis){var relativeValues = this._getRelativeValue(min,max);axis = (axis||"");p["relValue"+axis] = relativeValues[0];p["valueFactor"+axis] = relativeValues[1];p["unit"+axis] = (p["relValue"+axis]?size/p["relValue"+axis]:10);}
};dhtmlx.chart.radar = {pvt_render_radar:function(ctx,data,x,y,sIndex,map){this._renderRadarChart(ctx,data,x,y,sIndex,map);}, 
 
 _renderRadarChart:function(ctx,data,point0,point1,sIndex,map){if(!data.length)return;var coord = this._getPieParameters(point0,point1);var radius = (this._settings.radius?this._settings.radius:coord.radius);var x0 = (this._settings.x?this._settings.x:coord.x);var y0 = (this._settings.y?this._settings.y:coord.y);var ratioUnits = [];for(var i=0;i<data.length;i++)ratioUnits.push(1)
 var ratios = this._getRatios(ratioUnits,data.length);if(!sIndex)this._drawRadarAxises(ctx,ratios,x0,y0,radius,data);this._drawRadarData(ctx,ratios,x0,y0,radius,data,sIndex,map);},
 _drawRadarData:function(ctx,ratios,x,y,radius,data,sIndex,map){var alpha0,alpha1,areaWidth,config,i,min,max,pos0,pos1,posArr,r0,r1,relValue,startAlpha,value,value0,value1,valueFactor,unit,unitArr;config = this._settings;min = config.yAxis.start;max = config.yAxis.end;unitArr = this._getRelativeValue(min,max);relValue = unitArr[0];unit = (relValue?radius/relValue:radius/2);valueFactor = unitArr[1];startAlpha = -Math.PI/2;alpha0 = alpha1 = startAlpha;posArr = [];for(i=0;i<data.length;i++){if(!value1){value = config.value(data[i]);value0 = (value1||(parseFloat(value||0) - min)*valueFactor);}
 else
 value0 = value1;r0 = Math.floor(unit*value0);value = config.value((i!=(data.length-1))?data[i+1]:data[0]);value1 = (parseFloat(value||0) - min)*valueFactor;r1 = Math.floor(unit*value1);alpha0 = alpha1;alpha1 = ((i!=(data.length-1))?(startAlpha+ratios[i]-0.0001):startAlpha);pos0 = (pos1||this._getPositionByAngle(alpha0,x,y,r0));pos1 = this._getPositionByAngle(alpha1,x,y,r1);areaWidth = (config.eventRadius||(parseInt(config.item.radius.call(this,data[i]),10)+config.item.borderWidth));map.addRect(data[i].id,[pos0.x-areaWidth,pos0.y-areaWidth,pos0.x+areaWidth,pos0.y+areaWidth],sIndex);posArr.push(pos0);}
 if(config.fill)this._fillRadarChart(ctx,posArr,data);if(!config.disableLines)this._strokeRadarChart(ctx,posArr,data);if(!config.disableItems)this._drawRadarItemMarkers(ctx,posArr,data);posArr = null;},
 _drawRadarItemMarkers:function(ctx,points,data){for(var i=0;i < points.length;i++){this._drawItemOfLineChart(ctx,points[i].x,points[i].y,data[i]);}
 },
 _fillRadarChart:function(ctx,points,data){var pos0,pos1;ctx.globalAlpha= this._settings.alpha.call(this,{});ctx.beginPath();for(var i=0;i < points.length;i++){ctx.fillStyle = this._settings.fill.call(this,data[i]);pos0 = points[i];pos1 = (points[i+1]|| points[0]);if(!i){ctx.moveTo(pos0.x,pos0.y);}
 ctx.lineTo(pos1.x,pos1.y)
 }
 ctx.fill();ctx.globalAlpha=1;},
 _strokeRadarChart:function(ctx,points,data){var pos0,pos1;for(var i=0;i < points.length;i++){pos0 = points[i];pos1 = (points[i+1]|| points[0]);this._drawLine(ctx,pos0.x,pos0.y,pos1.x,pos1.y,this._settings.line.color.call(this,data[i]),this._settings.line.width)
 }
 },
 _drawRadarAxises:function(ctx,ratios,x,y,radius,data){var configY = this._settings.yAxis;var configX = this._settings.xAxis;var start = configY.start;var end = configY.end;var step = configY.step;var scaleParam= {};var config = this._settings.configYAxis;if(typeof config.step =="undefined"||typeof config.start=="undefined"||typeof config.end =="undefined"){var limits = this._getLimits();scaleParam = this._calculateScale(limits.min,limits.max);start = scaleParam.start;end = scaleParam.end;step = scaleParam.step;configY.end = end;configY.start = start;}
 var units = [];var i,j,p;var c=0;var stepHeight = radius*step/(end-start);var power,corr;if(step<1){power = Math.min(this._log10(step),(start<=0?0:this._log10(start)));corr = Math.pow(10,-power);}
 var angles = [];for(i = end;i>=start;i -=step){if(scaleParam.fixNum)i = parseFloat((new Number(i)).toFixed(scaleParam.fixNum));units.push(Math.floor(c*stepHeight)+ 0.5);if(corr){i = Math.round(i*corr)/corr;}
 var unitY = y-radius+units[units.length-1];this.renderTextAt("middle","left",x,unitY,
 configY.template(i.toString()),
 "dhx_axis_item_y dhx_radar"
 );if(ratios.length<2){this._drawScaleSector(ctx,"arc",x,y,radius-units[units.length-1],-Math.PI/2,3*Math.PI/2,i);return;}
 var startAlpha = -Math.PI/2;var alpha0 = startAlpha;var alpha1;for(j=0;j< ratios.length;j++){if(i==end)angles.push(alpha0);alpha1 = startAlpha+ratios[j]-0.0001;this._drawScaleSector(ctx,(config.lineShape||"line"),x,y,radius-units[units.length-1],alpha0,alpha1,i,j,data[i]);alpha0 = alpha1;}
 c++;}
 
 for(i=0;i< angles.length;i++){p = this._getPositionByAngle(angles[i],x,y,radius);this._drawLine(ctx,x,y,p.x,p.y,(configX?configX.lineColor.call(this,data[i]):"#cfcfcf"),((configX&&configX.lineWidth)?configX.lineWidth.call(this,data[i]):1));this._drawRadarScaleLabel(ctx,x,y,radius,angles[i],(configX?configX.template.call(this,data[i]):"&nbsp;"));}
 },
 _drawScaleSector:function(ctx,shape,x,y,radius,a1,a2,i,j){var pos1, pos2;if(radius<0)return false;pos1 = this._getPositionByAngle(a1,x,y,radius);pos2 = this._getPositionByAngle(a2,x,y,radius);var configY = this._settings.yAxis;if(configY.bg){ctx.beginPath();ctx.moveTo(x,y);if(shape=="arc")ctx.arc(x,y,radius,a1,a2,false);else{ctx.lineTo(pos1.x,pos1.y);ctx.lineTo(pos2.x,pos2.y);}
 ctx.fillStyle = configY.bg(i,j);ctx.moveTo(x,y);ctx.fill();ctx.closePath();}
 if(configY.lines(i,j)){ctx.lineWidth = 1;ctx.beginPath();if(shape=="arc")ctx.arc(x,y,radius,a1,a2,false);else{ctx.moveTo(pos1.x,pos1.y);ctx.lineTo(pos2.x,pos2.y);}
 ctx.strokeStyle = configY.lineColor(i,j);ctx.stroke();}
 },
 _drawRadarScaleLabel:function(ctx,x,y,r,a,text){var t = this.renderText(0,0,text,"dhx_axis_radar_title",1);var width = t.scrollWidth;var height = t.offsetHeight;var delta = 0.001;var pos = this._getPositionByAngle(a,x,y,r+5);var corr_x=0,corr_y=0;if(a<0||a>Math.PI){corr_y = -height;}
 if(a>Math.PI/2){corr_x = -width;}
 if(Math.abs(a+Math.PI/2)<delta||Math.abs(a-Math.PI/2)<delta){corr_x = -width/2;}
 else if(Math.abs(a)<delta||Math.abs(a-Math.PI)<delta){corr_y = -height/2;}
 t.style.top = pos.y+corr_y+"px";t.style.left = pos.x+corr_x+"px";t.style.width = width+"px";t.style.whiteSpace = "nowrap";}
};dhtmlx.chart.area = {pvt_render_area:function(ctx, data, point0, point1, sIndex, map){var params = this._calculateParametersOfLineChart(ctx,data,point0,point1,sIndex);var areaPos = (this._settings.eventRadius||Math.floor(params.cellWidth/2));if (data.length){ctx.globalAlpha = this._settings.alpha.call(this,data[0]);ctx.fillStyle = this._settings.color.call(this,data[0]);var y0 = this._getYPointOfLineChart(data[0],point0,point1,params);var x0 = (this._settings.offset?point0.x+params.cellWidth*0.5:point0.x);ctx.beginPath();ctx.moveTo(x0,point1.y);ctx.lineTo(x0,y0);map.addRect(data[0].id,[x0-areaPos,y0-areaPos,x0+areaPos,y0+areaPos],sIndex);if(!this._settings.yAxis)this.renderTextAt(false, (!this._settings.offset?false:true), x0, y0-this._settings.labelOffset, this._settings.label(data[0]));for(var i=1;i < data.length;i ++){var xi = x0+ Math.floor(params.cellWidth*i) - 0.5;var yi = this._getYPointOfLineChart(data[i],point0,point1,params);ctx.lineTo(xi,yi);map.addRect(data[i].id,[xi-areaPos,yi-areaPos,xi+areaPos,yi+areaPos],sIndex);if(!this._settings.yAxis)this.renderTextAt(false, (!this._settings.offset&&i==(data.length-1)?"left":"center"), xi, yi-this._settings.labelOffset, this._settings.label(data[i]));}
 ctx.lineTo(x0+Math.floor(params.cellWidth*[data.length-1]),point1.y);ctx.lineTo(x0,point1.y);ctx.fill();}
 }
};dhtmlx.chart.stackedArea ={pvt_render_stackedArea:function(ctx, data, point0, point1, sIndex, map){var params = this._calculateParametersOfLineChart(ctx,data,point0,point1,sIndex);var areaPos = (this._settings.eventRadius||Math.floor(params.cellWidth/2));var y1 = [];if (data.length){ctx.globalAlpha = this._settings.alpha.call(this,data[0]);ctx.fillStyle = this._settings.color.call(this,data[0]);var y01 = (sIndex?data[0].$startY:point1.y);var x0 = (this._settings.offset?point0.x+params.cellWidth*0.5:point0.x);var y02 = this._getYPointOfLineChart(data[0],point0,point1,params)-(sIndex?(point1.y-y01):0);y1[0] = y02;ctx.beginPath();ctx.moveTo(x0,y01);ctx.lineTo(x0,y02);map.addRect(data[0].id,[x0-areaPos,y02-areaPos,x0+areaPos,y02+areaPos],sIndex);if(!this._settings.yAxis)this.renderTextAt(false, true, x0, y02-this._settings.labelOffset, this._settings.label(data[0]));for(var i=1;i < data.length;i ++){var xi = x0+ Math.floor(params.cellWidth*i) - 0.5;var yi2 = this._getYPointOfLineChart(data[i],point0,point1,params)-(sIndex?(point1.y-data[i].$startY):0);y1[i] = yi2;ctx.lineTo(xi,yi2);map.addRect(data[i].id,[xi-areaPos,yi2-areaPos,xi+areaPos,yi2+areaPos],sIndex);if(!this._settings.yAxis)this.renderTextAt(false, true, xi, yi2-this._settings.labelOffset, this._settings.label(data[i]));}
 ctx.lineTo(x0+Math.floor(params.cellWidth*[data.length-1]),y01);if(sIndex){for(var i=data.length-1;i >=0 ;i--){var xi = x0+ Math.floor(params.cellWidth*i) - 0.5;var yi1 = data[i].$startY;ctx.lineTo(xi,yi1);}
 }
 else ctx.lineTo(x0+ Math.floor(params.cellWidth*(length-1)) - 0.5,y01);ctx.lineTo(x0,y01);ctx.fill();for(var i=0;i < data.length;i ++){data[i].$startY = y1[i];}
 }
 }
};dhtmlx.chart.spline = {pvt_render_spline:function(ctx, data, point0, point1, sIndex, map){var areaPos,config,i,items,j,params,radius,sparam,x,x0,x1,x2,y,y1,y2;params = this._calculateParametersOfLineChart(ctx,data,point0,point1,sIndex);config = this._settings;items = [];if (data.length){x0 = (config.offset?point0.x+params.cellWidth*0.5:point0.x);for(i=0;i < data.length;i ++){x = ((!i)?x0:Math.floor(params.cellWidth*i) - 0.5 + x0);y = this._getYPointOfLineChart(data[i],point0,point1,params);items.push({x:x,y:y});}
 sparam = this._getSplineParameters(items);for(i =0;i< items.length;i++){x1 = items[i].x;y1 = items[i].y;if(i<items.length-1){x2 = items[i+1].x;y2 = items[i+1].y;for(j = x1;j < x2;j++)this._drawLine(ctx,j,this._getSplineYPoint(j,x1,i,sparam.a,sparam.b,sparam.c,sparam.d),j+1,this._getSplineYPoint(j+1,x1,i,sparam.a,sparam.b,sparam.c,sparam.d),config.line.color(data[i]),config.line.width);this._drawLine(ctx,x2-1,this._getSplineYPoint(j,x1,i,sparam.a,sparam.b,sparam.c,sparam.d),x2,y2,config.line.color(data[i]),config.line.width);}
 this._drawItemOfLineChart(ctx,x1,y1,data[i],config.label(data[i]));radius = (parseInt(config.item.radius.call(this,data[i-1]),10)||2);areaPos = (config.eventRadius||radius+1);map.addRect(data[i].id,[x1-areaPos,y1-areaPos,x1+areaPos,y1+areaPos],sIndex);}
 

 }
 },
 
 _getSplineParameters:function(points){var h,i,u,v,s,a,b,c,d,n;h = [];m = [];n = points.length;for(i =0;i<n-1;i++){h[i] = points[i+1].x - points[i].x;m[i] = (points[i+1].y - points[i].y)/h[i];}
 u = [];v = [];u[0] = 0;u[1] = 2*(h[0] + h[1]);v[0] = 0;v[1] = 6*(m[1] - m[0]);for(i =2;i < n-1;i++){u[i] = 2*(h[i-1]+h[i]) - h[i-1]*h[i-1]/u[i-1];v[i] = 6*(m[i]-m[i-1]) - h[i-1]*v[i-1]/u[i-1];}
 
 s = [];s[n-1] = s[0] = 0;for(i = n -2;i>=1;i--)s[i] = (v[i] - h[i]*s[i+1])/u[i];a = [];b = [];c = [];d = [];for(i =0;i<n-1;i++){a[i] = points[i].y;b[i] = - h[i]*s[i+1]/6 - h[i]*s[i]/3 + (points[i+1].y-points[i].y)/h[i];c[i] = s[i]/2;d[i] = (s[i+1] - s[i])/(6*h[i]);}
 return {a:a,b:b,c:c,d:d};},
 
 _getSplineYPoint:function(x,xi,i,a,b,c,d){return a[i] + (x - xi)*(b[i] + (x-xi)*(c[i]+(x-xi)*d[i]));}
};dhtmlx.chart.barH = {pvt_render_barH:function(ctx, data, point0, point1, sIndex, map){var maxValue,minValue;var valueFactor;var relValue;var total_width = point1.x-point0.x;var yax = !!this._settings.yAxis;var xax = !!this._settings.xAxis;var limits = this._getLimits("h");maxValue = limits.max;minValue = limits.min;var cellWidth = Math.floor((point1.y-point0.y)/data.length);if(!sIndex)this._drawHScales(ctx,data,point0, point1,minValue,maxValue,cellWidth);if(yax){maxValue = parseFloat(this._settings.xAxis.end);minValue = parseFloat(this._settings.xAxis.start);}
 
 
 var relativeValues = this._getRelativeValue(minValue,maxValue);relValue = relativeValues[0];valueFactor = relativeValues[1];var unit = (relValue?total_width/relValue:10);if(!yax){var startValue = 10;unit = (relValue?(total_width-startValue)/relValue:10);}
 
 
 
 var barWidth = parseInt(this._settings.width,10);if((barWidth*this._series.length+4)>cellWidth) barWidth = cellWidth/this._series.length-4;var barOffset = Math.floor((cellWidth - barWidth*this._series.length)/2);var radius = (typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(barWidth/5));var inner_gradient = false;var gradient = this._settings.gradient;if (gradient&&typeof(gradient)!= "function"){inner_gradient = gradient;gradient = false;}else if (gradient){gradient = ctx.createLinearGradient(point0.x,point0.y,point1.x,point0.y);this._settings.gradient(gradient);}
 var scaleY = 0;if(!yax){this._drawLine(ctx,point0.x-0.5,point0.y,point0.x-0.5,point1.y,"#000000",1);}
 
 
 
 for(var i=0;i < data.length;i ++){var value = parseFloat(this._settings.value(data[i]||0));if(value>maxValue)value = maxValue;value -= minValue;value *= valueFactor;var x0 = point0.x;var y0 = point0.y+ barOffset + i*cellWidth+(barWidth+1)*sIndex;if((value<0&&this._settings.origin=="auto")||(this._settings.xAxis&&value===0&&!(this._settings.origin!="auto"&&this._settings.origin>minValue))){this.renderTextAt("middle", "right", x0+10,y0+barWidth/2+barOffset,this._settings.label(data[i]));continue;}
 if(value<0&&this._settings.origin!="auto"&&this._settings.origin>minValue){value = 0;}
 
 
 if(!yax)value += startValue/unit;var color = gradient||this._settings.color.call(this,data[i]);if(this._settings.border){this._drawBarHBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);}
 
 ctx.globalAlpha = this._settings.alpha.call(this,data[i]);var points = this._drawBarH(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient);if (inner_gradient!=false){this._drawBarHGradient(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient);}
 ctx.globalAlpha = 1;if(points[3]==y0){this.renderTextAt("middle", "left", points[0]-5,points[3]+Math.floor(barWidth/2),this._settings.label(data[i]));map.addRect(data[i].id,[points[0],points[3],points[2],points[3]+barWidth],sIndex);}else{this.renderTextAt("middle", false, points[2]+5,points[1]+Math.floor(barWidth/2),this._settings.label(data[i]));map.addRect(data[i].id,[points[0],y0,points[2],points[3]],sIndex);}
 
 }
 },
 
 _setBarHPoints:function(ctx,x0,y0,barWidth,radius,unit,value,offset,skipLeft){var angle_corr = 0;if(radius>unit*value){var sinA = (radius-unit*value)/radius;angle_corr = -Math.asin(sinA)+Math.PI/2;}
 
 ctx.moveTo(x0,y0+offset);var x1 = x0 + unit*value - radius - (radius?0:offset);if(radius<unit*value)ctx.lineTo(x1,y0+offset);var y2 = y0 + radius;if (radius&&radius>0)ctx.arc(x1,y2,radius-offset,-Math.PI/2+angle_corr,0,false);var y3 = y0 + barWidth - radius - (radius?0:offset);var x3 = x1 + radius - (radius?offset:0);ctx.lineTo(x3,y3);var x4 = x1;if (radius&&radius>0)ctx.arc(x4,y3,radius-offset,0,Math.PI/2-angle_corr,false);var y5 = y0 + barWidth-offset;ctx.lineTo(x0,y5);if(!skipLeft){ctx.lineTo(x0,y0+offset);}
 
 return [x3,y5];},
 _drawHScales:function(ctx,data,point0,point1,start,end,cellWidth){var x = this._drawHXAxis(ctx,data,point0,point1,start,end);this._drawHYAxis(ctx,data,point0,point1,cellWidth,x);},
 _drawHYAxis:function(ctx,data,point0,point1,cellWidth,yAxisX){if (!this._settings.yAxis)return;var unitPos;var x0 = parseInt((yAxisX?yAxisX:point0.x),10)-0.5;var y0 = point1.y+0.5;var y1 = point0.y;this._drawLine(ctx,x0,y0,x0,y1,this._settings.yAxis.color,1);for(var i=0;i < data.length;i ++){var right = ((this._settings.origin!="auto")&&(this._settings.view=="barH")&&(parseFloat(this._settings.value(data[i]))<this._settings.origin));unitPos = y1+cellWidth/2+i*cellWidth;this.renderTextAt("middle",(right?false:"left"),(right?x0+5:x0-5),unitPos,
 this._settings.yAxis.template(data[i]),
 "dhx_axis_item_y",(right?0:x0-10)
 );if(this._settings.yAxis.lines.call(this,data[i]))
 this._drawLine(ctx,point0.x,unitPos,point1.x,unitPos,this._settings.yAxis.lineColor.call(this,data[i]),1);}
 this._drawLine(ctx,point0.x+0.5,y1+0.5,point1.x,y1+0.5,this._settings.yAxis.lineColor.call(this,{}),1);this._setYAxisTitle(point0,point1);},
 _drawHXAxis:function(ctx,data,point0,point1,start,end){var step;var scaleParam= {};var axis = this._settings.xAxis;if (!axis)return;var y0 = point1.y+0.5;var x0 = point0.x-0.5;var x1 = point1.x-0.5;var yAxisStart = point0.x;this._drawLine(ctx,x0,y0,x1,y0,axis.color,1);if(axis.step)step = parseFloat(axis.step);if(typeof this._settings.configXAxis.step =="undefined"||typeof this._settings.configXAxis.start=="undefined"||typeof this._settings.configXAxis.end =="undefined"){scaleParam = this._calculateScale(start,end);start = scaleParam.start;end = scaleParam.end;step = scaleParam.step;this._settings.xAxis.end = end;this._settings.xAxis.start = start;this._settings.xAxis.step = step;};if(step===0)return;var stepHeight = (x1-x0)*step/(end-start);var c = 0;for(var i = start;i<=end;i += step){if(scaleParam.fixNum)i = parseFloat((new Number(i)).toFixed(scaleParam.fixNum));var xi = Math.floor(x0+c*stepHeight)+ 0.5;if(!(i==start&&this._settings.origin=="auto")&&axis.lines.call(this,i))
 this._drawLine(ctx,xi,y0,xi,point0.y,this._settings.xAxis.lineColor.call(this,i),1);if(i == this._settings.origin)yAxisStart = xi+1;this.renderTextAt(false, true,xi,y0+2,axis.template(i.toString()),"dhx_axis_item_x");c++;};this.renderTextAt(true, false, x0,point1.y+this._settings.padding.bottom-3,
 this._settings.xAxis.title,
 "dhx_axis_title_x",
 point1.x - point0.x
 );if (!axis.lines){;this._drawLine(ctx,x0,point0.y-0.5,x1,point0.y-0.5,this._settings.xAxis.color,0.2);}
 return yAxisStart;},
 _correctBarHParams:function(ctx,x,y,value,unit,barWidth,minValue){var yax = this._settings.yAxis;var axisStart = x;if(!!yax&&this._settings.origin!="auto" && (this._settings.origin>minValue)){x += (this._settings.origin-minValue)*unit;axisStart = x;value = value-(this._settings.origin-minValue);if(value < 0){value *= (-1);ctx.translate(x,y+barWidth);ctx.rotate(Math.PI);x = 0.5;y = 0;}
 x += 0.5;}
 
 return {value:value,x0:x,y0:y,start:axisStart}
 },
 _drawBarH:function(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient){ctx.save();var p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);ctx.fillStyle = color;ctx.beginPath();var points = this._setBarHPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,(this._settings.border?1:0));if (gradient&&!inner_gradient)ctx.lineTo(point0.x+total_width,p.y0+(this._settings.border?1:0));ctx.fill();ctx.restore();var y1 = p.y0;var y2 = (p.y0!=y0?y0:points[1]);var x1 = (p.y0!=y0?(p.start-points[0]):p.start);var x2 = (p.y0!=y0?p.start:points[0]);return [x1,y1,x2,y2];},
 _drawBarHBorder:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color){ctx.save();var p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);ctx.beginPath();this._setBorderStyles(ctx,color);ctx.globalAlpha =0.9;this._setBarHPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,ctx.lineWidth/2,1);ctx.stroke();ctx.restore();},
 _drawBarHGradient:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient){ctx.save();var p = this._correctBarHParams(ctx,x0,y0,value,unit,barWidth,minValue);var gradParam = this._setBarGradient(ctx,p.x0,p.y0+barWidth,p.x0+unit*p.value,p.y0,inner_gradient,color,"x");ctx.fillStyle = gradParam.gradient;ctx.beginPath();var points = this._setBarHPoints(ctx,p.x0,p.y0+gradParam.offset,barWidth-gradParam.offset*2,radius,unit,p.value,gradParam.offset);ctx.fill();ctx.globalAlpha = 1;ctx.restore();}
};dhtmlx.assert(dhtmlx.chart.barH);dhtmlx.chart.stackedBarH = {pvt_render_stackedBarH:function(ctx, data, point0, point1, sIndex, map){var maxValue,minValue;var valueFactor;var relValue;var total_width = point1.x-point0.x;var yax = !!this._settings.yAxis;var limits = this._getStackedLimits(data);maxValue = limits.max;minValue = limits.min;var cellWidth = Math.floor((point1.y-point0.y)/data.length);if(!sIndex)this._drawHScales(ctx,data,point0, point1,minValue,maxValue,cellWidth);if(yax){maxValue = parseFloat(this._settings.xAxis.end);minValue = parseFloat(this._settings.xAxis.start);}
 
 
 var relativeValues = this._getRelativeValue(minValue,maxValue);relValue = relativeValues[0];valueFactor = relativeValues[1];var unit = (relValue?total_width/relValue:10);if(!yax){var startValue = 10;unit = (relValue?(total_width-startValue)/relValue:10);}
 
 
 var barWidth = parseInt(this._settings.width,10);if((barWidth+4)>cellWidth) barWidth = cellWidth-4;var barOffset = Math.floor((cellWidth - barWidth)/2);var radius = 0;var inner_gradient = false;var gradient = this._settings.gradient;if (gradient){inner_gradient = true;}
 
 if(!yax){this._drawLine(ctx,point0.x-0.5,point0.y,point0.x-0.5,point1.y,"#000000",1);}
 
 for(var i=0;i < data.length;i ++){if(!sIndex)data[i].$startX = point0.x;var value = parseFloat(this._settings.value(data[i]||0));if(value>maxValue)value = maxValue;value -= minValue;value *= valueFactor;var x0 = point0.x;var y0 = point0.y+ barOffset + i*cellWidth;if(!sIndex)data[i].$startX = x0;else
 x0 = data[i].$startX;if(value<0||(this._settings.yAxis&&value===0)){this.renderTextAt("middle", true, x0+10,y0+barWidth/2,this._settings.label(data[i]));continue;}
 
 
 if(!yax)value += startValue/unit;var color = this._settings.color.call(this,data[i]);ctx.globalAlpha = this._settings.alpha.call(this,data[i]);ctx.fillStyle = this._settings.color.call(this,data[i]);ctx.beginPath();var points = this._setBarHPoints(ctx,x0,y0,barWidth,radius,unit,value,(this._settings.border?1:0));if (gradient&&!inner_gradient)ctx.lineTo(point0.x+total_width,y0+(this._settings.border?1:0));ctx.fill();if (inner_gradient!=false){var gradParam = this._setBarGradient(ctx,x0,y0+barWidth,x0,y0,inner_gradient,color,"x");ctx.fillStyle = gradParam.gradient;ctx.beginPath();points = this._setBarHPoints(ctx,x0,y0, barWidth,radius,unit,value,0);ctx.fill();}
 
 if(this._settings.border){this._drawBarHBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);}
 
 ctx.globalAlpha = 1;this.renderTextAt("middle",true,data[i].$startX+(points[0]-data[i].$startX)/2-1, y0+(points[1]-y0)/2, this._settings.label(data[i]));map.addRect(data[i].id,[data[i].$startX,y0,points[0],points[1]],sIndex);data[i].$startX = points[0];}
 }
};dhtmlx.chart.stackedBar = {pvt_render_stackedBar:function(ctx, data, point0, point1, sIndex, map){var maxValue,minValue;var valueFactor;var relValue;var total_height = point1.y-point0.y;var yax = !!this._settings.yAxis;var xax = !!this._settings.xAxis;var limits = this._getStackedLimits(data);maxValue = limits.max;minValue = limits.min;var cellWidth = Math.floor((point1.x-point0.x)/data.length);if(!sIndex)this._drawScales(ctx,data,point0, point1,minValue,maxValue,cellWidth);if(yax){maxValue = parseFloat(this._settings.yAxis.end);minValue = parseFloat(this._settings.yAxis.start);}
 
 
 var relativeValues = this._getRelativeValue(minValue,maxValue);relValue = relativeValues[0];valueFactor = relativeValues[1];var unit = (relValue?total_height/relValue:10);var barWidth = parseInt(this._settings.width,10);if(barWidth+4 > cellWidth)barWidth = cellWidth-4;var barOffset = Math.floor((cellWidth - barWidth)/2);var inner_gradient = (this._settings.gradient?this._settings.gradient:false);if(!xax){this._drawLine(ctx,point0.x,point1.y+0.5,point1.x,point1.y+0.5,"#000000",1);}
 
 for(var i=0;i < data.length;i ++){var value = parseFloat(this._settings.value(data[i]||0));if(!value){if(!sIndex||!data[i].$startY)data[i].$startY = point1.y;continue;}
 
 if(!sIndex)value -= minValue;value *= valueFactor;var x0 = point0.x + barOffset + i*cellWidth;var y0 = point1.y;if(!sIndex)data[i].$startY = y0;else
 y0 = data[i].$startY;if(y0 < (point0.y+1)) continue;if(value<0||(this._settings.yAxis&&value===0)){this.renderTextAt(true, true, x0+Math.floor(barWidth/2),y0,this._settings.label(data[i]));continue;}
 
 var color = this._settings.color.call(this,data[i]);ctx.globalAlpha = this._settings.alpha.call(this,data[i]);ctx.fillStyle = this._settings.color.call(this,data[i]);ctx.beginPath();var points = this._setStakedBarPoints(ctx,x0-(this._settings.border?0.5:0),y0,barWidth+(this._settings.border?0.5:0),unit,value,0,point0.y);ctx.fill();if (inner_gradient){ctx.save();var gradParam = this._setBarGradient(ctx,x0,y0,x0+barWidth,points[1],inner_gradient,color,"y");ctx.fillStyle = gradParam.gradient;ctx.beginPath();points = this._setStakedBarPoints(ctx,x0+gradParam.offset,y0,barWidth-gradParam.offset*2,unit,value,(this._settings.border?1:0),point0.y);ctx.fill();ctx.restore()
 }
 
 if(this._settings.border){ctx.save();this._setBorderStyles(ctx,color);ctx.beginPath();this._setStakedBarPoints(ctx,x0-0.5,y0,barWidth+1,unit,value,0,point0.y,1);ctx.stroke();ctx.restore();}
 ctx.globalAlpha = 1;this.renderTextAt(false, true, x0+Math.floor(barWidth/2),(points[1]+(y0-points[1])/2)-7,this._settings.label(data[i]));map.addRect(data[i].id,[x0,points[1],points[0],(data[i].$startY||y0)],sIndex);data[i].$startY = (this._settings.border?(points[1]+1):points[1]);}
 },
 
 _setStakedBarPoints:function(ctx,x0,y0,barWidth,unit,value,offset,minY,skipBottom){ctx.moveTo(x0,y0);var y1 = y0 - unit*value+offset;if(y1<minY)y1 = minY;ctx.lineTo(x0,y1);var x3 = x0 + barWidth;var y3 = y1;ctx.lineTo(x3,y3);var x5 = x0 + barWidth;ctx.lineTo(x5,y0);if(!skipBottom){ctx.lineTo(x0,y0);}
 
 return [x5,y3-2*offset];}
};dhtmlx.chart.line = {pvt_render_line:function(ctx, data, point0, point1, sIndex, map){var areaPos,config,i,params,radius,x0,x1,x2,y1,y2;params = this._calculateParametersOfLineChart(ctx,data,point0,point1,sIndex);config = this._settings;if (data.length){y1 = this._getYPointOfLineChart(data[0],point0,point1,params);x1 = (config.offset?point0.x+params.cellWidth*0.5:point0.x);x0 = x1;for(i=1;i <= data.length;i ++){x2 = ((i==data.length-1)&&!this._settings.offset)?point1.x:Math.floor(params.cellWidth*i) - 0.5 + x0;if (data.length!=i){y2 = this._getYPointOfLineChart(data[i],point0,point1,params);if(!y2)continue;if(config.line.width){this._drawLine(ctx,x1,y1,x2,y2,config.line.color.call(this,data[i-1]),config.line.width);if(config.line&&config.line.shadow){ctx.globalAlpha = 0.3;this._drawLine(ctx,x1+2,y1+config.line.width+8,x2+2,y2+config.line.width+8,"#eeeeee",config.line.width+3);ctx.globalAlpha = 1;}
 }
 }
 
 this._drawItemOfLineChart(ctx,x1,y1,data[i-1],!!config.offset);radius = (parseInt(config.item.radius.call(this,data[i-1]),10)||2);areaPos = (config.eventRadius||radius+1);map.addRect(data[i-1].id,[x1-areaPos,y1-areaPos,x1+areaPos,y1+areaPos],sIndex);y1=y2;x1=x2;}
 }
 },
 
 _drawItemOfLineChart:function(ctx,x0,y0,obj,label){var config = this._settings.item;var R = parseInt(config.radius.call(this,obj),10);ctx.save();if(config.shadow){ctx.lineWidth = 1;ctx.strokeStyle = "#bdbdbd";ctx.fillStyle = "#bdbdbd";var alphas = [0.1,0.2,0.3];for(var i=(alphas.length-1);i>=0;i--){ctx.globalAlpha = alphas[i];ctx.strokeStyle = "#d0d0d0";ctx.beginPath();this._strokeChartItem(ctx,x0,y0+2*R/3,R+i+1,config.type);ctx.stroke();}
 ctx.beginPath();ctx.globalAlpha = 0.3;ctx.fillStyle = "#bdbdbd";this._strokeChartItem(ctx,x0,y0+2*R/3,R+1,config.type);ctx.fill();}
 ctx.restore();ctx.lineWidth = config.borderWidth;ctx.fillStyle = config.color.call(this,obj);ctx.strokeStyle = config.borderColor.call(this,obj);ctx.globalAlpha = config.alpha.call(this,obj);ctx.beginPath();this._strokeChartItem(ctx,x0,y0,R+1,config.type);ctx.fill();ctx.stroke();ctx.globalAlpha = 1;if(label)this.renderTextAt(false, true, x0,y0-R-this._settings.labelOffset,this._settings.label.call(this,obj));},
 _strokeChartItem:function(ctx,x0,y0,R,type){if(type && (type=="square" || type=="s")){R *= Math.sqrt(2)/2;ctx.moveTo(x0-R-ctx.lineWidth/2,y0-R);ctx.lineTo(x0+R,y0-R);ctx.lineTo(x0+R,y0+R);ctx.lineTo(x0-R,y0+R);ctx.lineTo(x0-R,y0-R);}
 else if(type && (type=="diamond" || type=="d")){var corr = (ctx.lineWidth>1?ctx.lineWidth*Math.sqrt(2)/4:0);ctx.moveTo(x0,y0-R);ctx.lineTo(x0+R,y0);ctx.lineTo(x0,y0+R);ctx.lineTo(x0-R,y0);ctx.lineTo(x0+corr,y0-R-corr);}
 else if(type && (type=="triangle" || type=="t")){ctx.moveTo(x0,y0-R);ctx.lineTo(x0+Math.sqrt(3)*R/2,y0+R/2);ctx.lineTo(x0-Math.sqrt(3)*R/2,y0+R/2);ctx.lineTo(x0,y0-R);}
 else
 ctx.arc(x0,y0,R,0,Math.PI*2,true);},
 
 _getYPointOfLineChart: function(data,point0,point1,params){var minValue = params.minValue;var maxValue = params.maxValue;var unit = params.unit;var valueFactor = params.valueFactor;var value = this._settings.value(data);var v = (parseFloat(value||0) - minValue)*valueFactor;if(!this._settings.yAxis)v += params.startValue/unit;var y = point1.y - Math.floor(unit*v);if(v<0)y = point1.y;if(value > maxValue)y = point0.y;if(value < minValue)y = point1.y;return y;},
 _calculateParametersOfLineChart: function(ctx,data,point0,point1,sIndex){var params = {};var relValue;params.totalHeight = point1.y-point0.y;params.cellWidth = Math.round((point1.x-point0.x)/((!this._settings.offset)?(data.length-1):data.length));var yax = !!this._settings.yAxis;var limits = (this._settings.view.indexOf("stacked")!=-1?this._getStackedLimits(data):this._getLimits());params.maxValue = limits.max;params.minValue = limits.min;if(!sIndex)this._drawScales(ctx,data, point0, point1,params.minValue,params.maxValue,params.cellWidth);if(yax){params.maxValue = parseFloat(this._settings.yAxis.end);params.minValue = parseFloat(this._settings.yAxis.start);}
 
 
 var relativeValues = this._getRelativeValue(params.minValue,params.maxValue);relValue = relativeValues[0];params.valueFactor = relativeValues[1];params.unit = (relValue?params.totalHeight/relValue:10);params.startValue = 0;if(!yax){params.startValue = 10;if(params.unit!=params.totalHeight)params.unit = (relValue?(params.totalHeight - params.startValue)/relValue:10);}
 return params;}
};dhtmlx.chart.bar = {pvt_render_bar:function(ctx, data, point0, point1, sIndex, map){var maxValue,minValue;var valueFactor;var relValue;var total_height = point1.y-point0.y;var yax = !!this._settings.yAxis;var xax = !!this._settings.xAxis;var limits = this._getLimits();maxValue = limits.max;minValue = limits.min;var cellWidth = Math.floor((point1.x-point0.x)/data.length);if(!sIndex&&!(this._settings.origin!="auto"&&!yax)){this._drawScales(ctx,data,point0, point1,minValue,maxValue,cellWidth);}
 
 
 if(yax){maxValue = parseFloat(this._settings.yAxis.end);minValue = parseFloat(this._settings.yAxis.start);}
 
 
 var relativeValues = this._getRelativeValue(minValue,maxValue);relValue = relativeValues[0];valueFactor = relativeValues[1];var unit = (relValue?total_height/relValue:relValue);if(!yax&&!(this._settings.origin!="auto"&&xax)){var startValue = 10;unit = (relValue?(total_height-startValue)/relValue:startValue);}
 
 if(!sIndex&&(this._settings.origin!="auto"&&!yax)&&this._settings.origin>minValue){this._drawXAxis(ctx,data,point0,point1,cellWidth,point1.y-unit*(this._settings.origin-minValue));}
 
 
 var barWidth = parseInt(this._settings.width,10);if(this._series&&(barWidth*this._series.length+4)>cellWidth) barWidth = parseInt(cellWidth/this._series.length-4,10);var barOffset = Math.floor((cellWidth - barWidth*this._series.length)/2);var radius = (typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(barWidth/5));var inner_gradient = false;var gradient = this._settings.gradient;if(gradient && typeof(gradient)!= "function"){inner_gradient = gradient;gradient = false;}else if (gradient){gradient = ctx.createLinearGradient(0,point1.y,0,point0.y);this._settings.gradient(gradient);}
 
 if(!xax){this._drawLine(ctx,point0.x,point1.y+0.5,point1.x,point1.y+0.5,"#000000",1);}
 
 for(var i=0;i < data.length;i ++){var value = parseFloat(this._settings.value(data[i]||0));if(value>maxValue)value = maxValue;value -= minValue;value *= valueFactor;var x0 = point0.x + barOffset + i*cellWidth+(barWidth+1)*sIndex;var y0 = point1.y+0.5;if(value<0||(this._settings.yAxis&&value===0&&!(this._settings.origin!="auto"&&this._settings.origin>minValue))){this.renderTextAt(true, true, x0+Math.floor(barWidth/2),y0,this._settings.label(data[i]));continue;}
 
 
 if(!yax&&!(this._settings.origin!="auto"&&xax)) value += startValue/unit;var color = gradient||this._settings.color.call(this,data[i]);ctx.globalAlpha = this._settings.alpha.call(this,data[i]);var points = this._drawBar(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient);if (inner_gradient){this._drawBarGradient(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient);}
 
 if(this._settings.border)this._drawBarBorder(ctx,x0,y0,barWidth,minValue,radius,unit,value,color);ctx.globalAlpha = 1;if(points[0]!=x0)this.renderTextAt(false, true, x0+Math.floor(barWidth/2),points[1],this._settings.label(data[i]));else
 this.renderTextAt(true, true, x0+Math.floor(barWidth/2),points[3],this._settings.label(data[i]));map.addRect(data[i].id,[x0,points[3],points[2],points[1]],sIndex);}
 },
 _correctBarParams:function(ctx,x,y,value,unit,barWidth,minValue){var xax = this._settings.xAxis;var axisStart = y;if(!!xax&&this._settings.origin!="auto" && (this._settings.origin>minValue)){y -= (this._settings.origin-minValue)*unit;axisStart = y;value = value-(this._settings.origin-minValue);if(value < 0){value *= (-1);ctx.translate(x+barWidth,y);ctx.rotate(Math.PI);x = 0;y = 0;}
 y -= 0.5;}
 
 return {value:value,x0:parseInt(x,10),y0:parseInt(y,10),start:axisStart}
 },
 _drawBar:function(ctx,point0,x0,y0,barWidth,minValue,radius,unit,value,color,gradient,inner_gradient){ctx.save();ctx.fillStyle = color;var p = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);var points = this._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,(this._settings.border?1:0));if (gradient&&!inner_gradient)ctx.lineTo(p.x0+(this._settings.border?1:0),point0.y);ctx.fill();ctx.restore();var x1 = p.x0;var x2 = (p.x0!=x0?x0+points[0]:points[0]);var y1 = (p.x0!=x0?(p.start-points[1]):y0);var y2 = (p.x0!=x0?p.start:points[1]);return [x1,y1,x2,y2];},
 _setBorderStyles:function(ctx,color){var hsv,rgb;rgb = dhtmlx.math.toRgb(color);hsv = dhtmlx.math.rgbToHsv(rgb[0],rgb[1],rgb[2]);hsv[2] /= 2;color = "rgb("+dhtmlx.math.hsvToRgb(hsv[0],hsv[1],hsv[2])+")";ctx.strokeStyle = color;if(ctx.globalAlpha==1)ctx.globalAlpha = 0.9;},
 _drawBarBorder:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color){var p;ctx.save();p = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);this._setBorderStyles(ctx,color);this._setBarPoints(ctx,p.x0,p.y0,barWidth,radius,unit,p.value,ctx.lineWidth/2,1);ctx.stroke();ctx.restore();},
 _drawBarGradient:function(ctx,x0,y0,barWidth,minValue,radius,unit,value,color,inner_gradient){ctx.save();var p = this._correctBarParams(ctx,x0,y0,value,unit,barWidth,minValue);var gradParam = this._setBarGradient(ctx,p.x0,p.y0,p.x0+barWidth,p.y0-unit*p.value+2,inner_gradient,color,"y");var borderOffset = this._settings.border?1:0;ctx.fillStyle = gradParam.gradient;this._setBarPoints(ctx,p.x0+gradParam.offset,p.y0,barWidth-gradParam.offset*2,radius,unit,p.value,gradParam.offset+borderOffset);ctx.fill();ctx.restore();},
 
 _setBarPoints:function(ctx,x0,y0,barWidth,radius,unit,value,offset,skipBottom){ctx.beginPath();var angle_corr = 0;if(radius>unit*value){var cosA = (radius-unit*value)/radius;if(cosA<=1&&cosA>=-1)angle_corr = -Math.acos(cosA)+Math.PI/2;}
 
 ctx.moveTo(x0+offset,y0);var y1 = y0 - Math.floor(unit*value) + radius + (radius?0:offset);if(radius<unit*value)ctx.lineTo(x0+offset,y1);var x2 = x0 + radius;if (radius&&radius>0)ctx.arc(x2,y1,radius-offset,-Math.PI+angle_corr,-Math.PI/2,false);var x3 = x0 + barWidth - radius - (radius?0:offset);var y3 = y1 - radius+(radius?offset:0);ctx.lineTo(x3,y3);if (radius&&radius>0)ctx.arc(x3,y1,radius-offset,-Math.PI/2,0-angle_corr,false);var x5 = x0 + barWidth-offset;ctx.lineTo(x5,y0);if(!skipBottom){ctx.lineTo(x0+offset,y0);}
 
 return [x5,y3];}
};dhtmlx.chart.pie = {pvt_render_pie:function(ctx,data,x,y,sIndex,map){this._renderPie(ctx,data,x,y,1,map);},
 
 _renderPie:function(ctx,data,point0,point1,ky,map){if(!data.length)return;var coord = this._getPieParameters(point0,point1);var radius = (this._settings.radius?this._settings.radius:coord.radius);if(radius<0)return;var values = this._getValues(data);var totalValue = this._getTotalValue(values);var ratios = this._getRatios(values,totalValue);var x0 = (this._settings.x?this._settings.x:coord.x);var y0 = (this._settings.y?this._settings.y:coord.y);if(ky==1&&this._settings.shadow)this._addShadow(ctx,x0,y0,radius);y0 = y0/ky;var alpha0 = -Math.PI/2;var angles = [];ctx.scale(1,ky);if (this._settings.gradient){var x1 = (ky!=1?x0+radius/3:x0);var y1 = (ky!=1?y0+radius/3:y0);this._showRadialGradient(ctx,x0,y0,radius,x1,y1);}
 for(var i = 0;i < data.length;i++){if (!values[i])continue;ctx.strokeStyle = this._settings.lineColor.call(this,data[i]);ctx.beginPath();ctx.moveTo(x0,y0);angles.push(alpha0);alpha1 = -Math.PI/2+ratios[i]-0.0001;ctx.arc(x0,y0,radius,alpha0,alpha1,false);ctx.lineTo(x0,y0);var color = this._settings.color.call(this,data[i]);ctx.fillStyle = color;ctx.fill();if(this._settings.pieInnerText)this._drawSectorLabel(x0,y0,5*radius/6,alpha0,alpha1,ky,this._settings.pieInnerText(data[i],totalValue),true);if(this._settings.label)this._drawSectorLabel(x0,y0,radius+this._settings.labelOffset,alpha0,alpha1,ky,this._settings.label(data[i]));if(ky!=1){this._createLowerSector(ctx,x0,y0,alpha0,alpha1,radius,true);ctx.fillStyle = "#000000";ctx.globalAlpha = 0.2;this._createLowerSector(ctx,x0,y0,alpha0,alpha1,radius,false);ctx.globalAlpha = 1;ctx.fillStyle = color;}
 
 map.addSector(data[i].id,alpha0,alpha1,x0,y0,radius,ky);alpha0 = alpha1;}
 
 ctx.globalAlpha = 0.8;var p;for(i=0;i< angles.length;i++){p = this._getPositionByAngle(angles[i],x0,y0,radius);this._drawLine(ctx,x0,y0,p.x,p.y,this._settings.lineColor.call(this,data[i]),2);}
 if(ky==1){ctx.lineWidth = 2;ctx.strokeStyle = "#ffffff";ctx.beginPath();ctx.arc(x0,y0,radius+1,0,2*Math.PI,false);ctx.stroke();}
 ctx.globalAlpha =1;ctx.scale(1,1/ky);},
 
 _getValues:function(data){var v = [];for(var i = 0;i < data.length;i++)v.push(parseFloat(this._settings.value(data[i])||0));return v;},
 
 _getTotalValue:function(values){var t=0;for(var i = 0;i < values.length;i++)t += values[i];return t;},
 
 _getRatios:function(values,totalValue){var value;var ratios = [];var prevSum = 0;totalValue = totalValue||this._getTotalValue(values);for(var i = 0;i < values.length;i++){value = values[i];ratios[i] = Math.PI*2*(totalValue?((value+prevSum)/totalValue):(1/data.length));prevSum += value;}
 return ratios;},
 
 _getPieParameters:function(point0,point1){var width = point1.x-point0.x;var height = point1.y-point0.y;var x0 = point0.x+width/2;var y0 = point0.y+height/2;var radius = Math.min(width/2,height/2);return {"x":x0,"y":y0,"radius":radius};},
 
 _createLowerSector:function(ctx,x0,y0,a1,a2,R,line){ctx.lineWidth = 1;if(!((a1<=0 && a2>=0)||(a1>=0 && a2<=Math.PI)||(Math.abs(a1-Math.PI)>0.003&&a1<=Math.PI && a2>=Math.PI))) return;if(a1<=0 && a2>=0){a1 = 0;line = false;this._drawSectorLine(ctx,x0,y0,R,a1,a2);}
 if(a1<=Math.PI && a2>=Math.PI){a2 = Math.PI;line = false;this._drawSectorLine(ctx,x0,y0,R,a1,a2);}
 
 var offset = (this._settings.height||Math.floor(R/4))/this._settings.cant;ctx.beginPath();ctx.arc(x0,y0,R,a1,a2,false);ctx.lineTo(x0+R*Math.cos(a2),y0+R*Math.sin(a2)+offset);ctx.arc(x0,y0+offset,R,a2,a1,true);ctx.lineTo(x0+R*Math.cos(a1),y0+R*Math.sin(a1));ctx.fill();if(line)ctx.stroke();},
 
 _drawSectorLine:function(ctx,x0,y0,R,a1,a2){ctx.beginPath();ctx.arc(x0,y0,R,a1,a2,false);ctx.stroke();},
 
 _addShadow:function(ctx,x,y,R){ctx.globalAlpha = 0.5;var shadows = ["#c4c4c4","#c6c6c6","#cacaca","#dcdcdc","#dddddd","#e0e0e0","#eeeeee","#f5f5f5","#f8f8f8"];for(var i = shadows.length-1;i>-1;i--){ctx.beginPath();ctx.fillStyle = shadows[i];ctx.arc(x+1,y+1,R+i,0,Math.PI*2,true);ctx.fill();}
 ctx.globalAlpha = 1
 },
 
 _getGrayGradient:function(gradient){gradient.addColorStop(0.0,"#ffffff");gradient.addColorStop(0.7,"#7a7a7a");gradient.addColorStop(1.0,"#000000");return gradient;},
 
 _showRadialGradient:function(ctx,x,y,radius,x0,y0){ctx.beginPath();var gradient;if(typeof this._settings.gradient!= "function"){gradient = ctx.createRadialGradient(x0,y0,radius/4,x,y,radius);gradient = this._getGrayGradient(gradient);}
 else gradient = this._settings.gradient(gradient);ctx.fillStyle = gradient;ctx.arc(x,y,radius,0,Math.PI*2,true);ctx.fill();ctx.globalAlpha = 0.7;},
 
 _drawSectorLabel:function(x0,y0,R,alpha1,alpha2,ky,text,in_width){var t = this.renderText(0,0,text,0,1);if (!t)return;var labelWidth = t.scrollWidth;t.style.width = labelWidth+"px";if (labelWidth>x0)labelWidth = x0;var width = (alpha2-alpha1<0.2?4:8);if (in_width)width = labelWidth/1.8;var alpha = alpha1+(alpha2-alpha1)/2;R = R-(width-8)/2;var corr_x = - width;var corr_y = -8;var align = "right";if(alpha>=Math.PI/2 && alpha<Math.PI || alpha<=3*Math.PI/2 && alpha>=Math.PI){corr_x = -labelWidth-corr_x+1;align = "left";}
 
 
 var offset = 0;if(!in_width&&ky<1&&(alpha>0&&alpha<Math.PI))
 offset = (this._settings.height||Math.floor(R/4))/ky;var y = (y0+Math.floor((R+offset)*Math.sin(alpha)))*ky+corr_y;var x = x0+Math.floor((R+width/2)*Math.cos(alpha))+corr_x;var left_end = (alpha2 < Math.PI/2+0.01);var left_start = (alpha1 < Math.PI/2);if (left_start && left_end){x = Math.max(x,x0+3);if(alpha2-alpha1<0.2)x = x0;}
 else if (!left_start && !left_end)x = Math.min(x,x0-labelWidth);else if (!in_width&&(alpha>=Math.PI/2 && alpha<Math.PI || alpha<=3*Math.PI/2 && alpha>=Math.PI)){x += labelWidth/3;}
 

 
 t.style.top = y+"px";t.style.left = x+"px";t.style.width = labelWidth+"px";t.style.textAlign = align;t.style.whiteSpace = "nowrap";}
};dhtmlx.chart.pie3D = {pvt_render_pie3D:function(ctx,data,x,y,sIndex,map){this._renderPie(ctx,data,x,y,this._settings.cant,map);}
};dhtmlx.chart.donut = {pvt_render_donut:function(ctx,data,point0,point1,sIndex,map){if(!data.length)return;this._renderPie(ctx,data,point0,point1,1,map);var config = this._settings;var coord = this._getPieParameters(point0,point1);var pieRadius = (config.radius?config.radius:coord.radius);var innerRadius = ((config.innerRadius&&(config.innerRadius<pieRadius))?config.innerRadius:pieRadius/3);var x0 = (config.x?config.x:coord.x);var y0 = (config.y?config.y:coord.y);ctx.fillStyle = "#ffffff";ctx.beginPath();ctx.arc(x0,y0,innerRadius,0,Math.PI*2,true);ctx.fill();}
};dhtmlx.Template={_cache:{},
 empty:function(){return "";},
 setter:function(value){return dhtmlx.Template.fromHTML(value);},
 obj_setter:function(value){var f = dhtmlx.Template.setter(value);var obj = this;return function(){return f.apply(obj, arguments);};},
 fromHTML:function(str){if (typeof str == "function")return str;if (this._cache[str])return this._cache[str];str=(str||"").toString();str=str.replace(/[\r\n]+/g,"\\n");str=str.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,"\"+(obj.$1?\"$2\":\"$3\")+\"");str=str.replace(/\{common\.([^}\(]*)\}/g,"\"+common.$1+\"");str=str.replace(/\{common\.([^\}\(]*)\(\)\}/g,"\"+(common.$1?common.$1(obj):\"\")+\"");str=str.replace(/\{obj\.([^}]*)\}/g,"\"+obj.$1+\"");str=str.replace(/#([a-z0-9_]+)#/gi,"\"+obj.$1+\"");str=str.replace(/\{obj\}/g,"\"+obj+\"");str=str.replace(/\{-obj/g,"{obj");str=str.replace(/\{-common/g,"{common");str="return \""+str+"\";";return this._cache[str]= Function("obj","common",str);}
};dhtmlx.Type={add:function(obj, data){if (!obj.types && obj.prototype.types)obj = obj.prototype;if (dhtmlx.assert_enabled())
 this.assert_event(data);var name = data.name||"default";this._template(data);this._template(data,"edit");this._template(data,"loading");obj.types[name]=dhtmlx.extend(dhtmlx.extend({},(obj.types[name]||this._default)),data);return name;},
 
 _default:{css:"default",
 template:function(){return "";},
 template_edit:function(){return "";},
 template_loading:function(){return "...";},
 width:150,
 height:80,
 margin:5,
 padding:0
 },
 
 _template:function(obj,name){name = "template"+(name?("_"+name):"");var data = obj[name];if (data && (typeof data == "string")){if (data.indexOf("->")!=-1){data = data.split("->");switch(data[0]){case "html": 
 data = dhtmlx.html.getValue(data[1]).replace(/\"/g,"\\\"");break;case "http": 
 data = new dhtmlx.ajax().sync().get(data[1],{uid:(new Date()).valueOf()}).responseText;break;default:
 
 break;}
 }
 obj[name] = dhtmlx.Template.fromHTML(data);}
 }
};dhtmlx.SingleRender={_init:function(){},
 
 _toHTML:function(obj){return this.type._item_start(obj,this.type)+this.type.template(obj,this.type)+this.type._item_end;},
 
 render:function(){if (!this.callEvent || this.callEvent("onBeforeRender",[this.data])){if (this.data)this._dataobj.innerHTML = this._toHTML(this.data);if (this.callEvent)this.callEvent("onAfterRender",[]);}
 }
};dhtmlx.ui.Tooltip=function(container){this.name = "Tooltip";this.version = "3.0";if (dhtmlx.assert_enabled()) this._assert();if (typeof container == "string"){container = {template:container };}
 
 dhtmlx.extend(this, dhtmlx.Settings);dhtmlx.extend(this, dhtmlx.SingleRender);this._parseSettings(container,{type:"default",
 dy:0,
 dx:20
 });this._dataobj = this._obj = document.createElement("DIV");this._obj.className="dhx_tooltip";dhtmlx.html.insertBefore(this._obj,document.body.firstChild);};dhtmlx.ui.Tooltip.prototype = {show:function(data,pos){if (this._disabled)return;if (this.data!=data){this.data=data;this.render(data);}
 
 this._obj.style.top = pos.y+this._settings.dy+"px";this._obj.style.left = pos.x+this._settings.dx+"px";this._obj.style.display="block";},
 
 hide:function(){this.data=null;this._obj.style.display="none";},
 disable:function(){this._disabled = true;},
 enable:function(){this._disabled = false;},
 types:{"default":dhtmlx.Template.fromHTML("{obj.id}")
 },
 template_item_start:dhtmlx.Template.empty,
 template_item_end:dhtmlx.Template.empty
};dhtmlx.AutoTooltip = {tooltip_setter:function(value){var t = new dhtmlx.ui.Tooltip(value);this.attachEvent("onMouseMove",function(id,e){t.show(this.get(id),dhtmlx.html.pos(e));});this.attachEvent("onMouseOut",function(id,e){t.hide();});this.attachEvent("onMouseMoving",function(id,e){t.hide();});return t;}
};dhtmlx.ajax = function(url,call,master){if (arguments.length!==0){var http_request = new dhtmlx.ajax();if (master)http_request.master=master;http_request.get(url,null,call);}
 if (!this.getXHR)return new dhtmlx.ajax();return this;};dhtmlx.ajax.prototype={getXHR:function(){if (dhtmlx._isIE)return new ActiveXObject("Microsoft.xmlHTTP");else 
 return new XMLHttpRequest();},
 
 send:function(url,params,call){var x=this.getXHR();if (typeof call == "function")call = [call];if (typeof params == "object"){var t=[];for (var a in params){var value = params[a];if (value === null || value === dhtmlx.undefined)value = "";t.push(a+"="+encodeURIComponent(value));}
 params=t.join("&");}
 if (params && !this.post){url=url+(url.indexOf("?")!=-1 ? "&" : "?")+params;params=null;}
 
 x.open(this.post?"POST":"GET",url,!this._sync);if (this.post)x.setRequestHeader('Content-type','application/x-www-form-urlencoded');var self=this;x.onreadystatechange= function(){if (!x.readyState || x.readyState == 4){if (call && self)for (var i=0;i < call.length;i++)if (call[i])call[i].call((self.master||self),x.responseText,x.responseXML,x);self.master=null;call=self=null;}
 };x.send(params||null);return x;},
 
 get:function(url,params,call){this.post=false;return this.send(url,params,call);},
 
 post:function(url,params,call){this.post=true;return this.send(url,params,call);}, 
 sync:function(){this._sync = true;return this;}
};dhtmlx.AtomDataLoader={_init:function(config){this.data = {};if (config){this._settings.datatype = config.datatype||"json";this._after_init.push(this._load_when_ready);}
 },
 _load_when_ready:function(){this._ready_for_data = true;if (this._settings.url)this.url_setter(this._settings.url);if (this._settings.data)this.data_setter(this._settings.data);},
 url_setter:function(value){if (!this._ready_for_data)return value;this.load(value, this._settings.datatype);return value;},
 data_setter:function(value){if (!this._ready_for_data)return value;this.parse(value, this._settings.datatype);return true;},
 
 load:function(url,call){this.callEvent("onXLS",[]);if (typeof call == "string"){this.data.driver = dhtmlx.DataDriver[call];call = arguments[2];}
 else
 this.data.driver = dhtmlx.DataDriver["xml"];dhtmlx.ajax(url,[this._onLoad,call],this);},
 
 parse:function(data,type){this.callEvent("onXLS",[]);this.data.driver = dhtmlx.DataDriver[type||"xml"];this._onLoad(data,null);},
 
 _onLoad:function(text,xml,loader){var driver = this.data.driver;var top = driver.getRecords(driver.toObject(text,xml))[0];this.data=(driver?driver.getDetails(top):text);this.callEvent("onXLE",[]);},
 _check_data_feed:function(data){if (!this._settings.dataFeed || this._ignore_feed || !data)return true;var url = this._settings.dataFeed;if (typeof url == "function")return url.call(this, (data.id||data), data);url = url+(url.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(data.id||data);this.callEvent("onXLS",[]);dhtmlx.ajax(url, function(text,xml){this._ignore_feed=true;this.setValues(dhtmlx.DataDriver.json.toObject(text)[0]);this._ignore_feed=false;this.callEvent("onXLE",[]);}, this);return false;}
};dhtmlx.DataDriver={};dhtmlx.DataDriver.json={toObject:function(data){if (!data)data="[]";if (typeof data == "string"){eval ("dhtmlx.temp="+data);return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){if (data && !(data instanceof Array))
 return [data];return data;},
 
 getDetails:function(data){return data;},
 
 getInfo:function(data){return {_size:(data.total_count||0),
 _from:(data.pos||0),
 _key:(data.dhx_security)
 };}
};dhtmlx.DataDriver.json_ext={toObject:function(data){if (!data)data="[]";if (typeof data == "string"){var temp;eval ("temp="+data);dhtmlx.temp = [];var header = temp.header;for (var i = 0;i < temp.data.length;i++){var item = {};for (var j = 0;j < header.length;j++){if (typeof(temp.data[i][j])!= "undefined")
 item[header[j]] = temp.data[i][j];}
 dhtmlx.temp.push(item);}
 return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){if (data && !(data instanceof Array))
 return [data];return data;},
 
 getDetails:function(data){return data;},
 
 getInfo:function(data){return {_size:(data.total_count||0),
 _from:(data.pos||0)
 };}
};dhtmlx.DataDriver.html={toObject:function(data){if (typeof data == "string"){var t=null;if (data.indexOf("<")==-1) 
 t = dhtmlx.toNode(data);if (!t){t=document.createElement("DIV");t.innerHTML = data;}
 
 return t.getElementsByTagName(this.tag);}
 return data;},
 
 getRecords:function(data){if (data.tagName)return data.childNodes;return data;},
 
 getDetails:function(data){return dhtmlx.DataDriver.xml.tagToObject(data);},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };},
 tag: "LI"
};dhtmlx.DataDriver.jsarray={toObject:function(data){if (typeof data == "string"){eval ("dhtmlx.temp="+data);return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){return data;},
 
 getDetails:function(data){var result = {};for (var i=0;i < data.length;i++)result["data"+i]=data[i];return result;},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };}
};dhtmlx.DataDriver.csv={toObject:function(data){return data;},
 
 getRecords:function(data){return data.split(this.row);},
 
 getDetails:function(data){data = this.stringToArray(data);var result = {};for (var i=0;i < data.length;i++)result["data"+i]=data[i];return result;},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };},
 
 stringToArray:function(data){data = data.split(this.cell);for (var i=0;i < data.length;i++)data[i] = data[i].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"");return data;},
 row:"\n", 
 cell:"," 
};dhtmlx.DataDriver.xml={toObject:function(text,xml){if (xml && (xml=this.checkResponse(text,xml))) 
 return xml;if (typeof text == "string"){return this.fromString(text);}
 return text;},
 
 getRecords:function(data){return this.xpath(data,this.records);},
 records:"/*/item",
 
 getDetails:function(data){return this.tagToObject(data,{});},
 
 getInfo:function(data){return {_size:(data.documentElement.getAttribute("total_count")||0),
 _from:(data.documentElement.getAttribute("pos")||0),
 _key:(data.documentElement.getAttribute("dhx_security"))
 };},
 
 xpath:function(xml,path){if (window.XPathResult){var node=xml;if(xml.nodeName.indexOf("document")==-1)
 xml=xml.ownerDocument;var res = [];var col = xml.evaluate(path, node, null, XPathResult.ANY_TYPE, null);var temp = col.iterateNext();while (temp){res.push(temp);temp = col.iterateNext();}
 return res;}
 else {var test = true;try {if (typeof(xml.selectNodes)=="undefined")
 test = false;}catch(e){}
 
 if (test)return xml.selectNodes(path);else {var name = path.split("/").pop();return xml.getElementsByTagName(name);}
 }
 },
 
 tagToObject:function(tag,z){z=z||{};var flag=false;var a=tag.attributes;if(a && a.length){for (var i=0;i<a.length;i++)z[a[i].name]=a[i].value;flag = true;}
 
 
 var b=tag.childNodes;var state = {};for (var i=0;i<b.length;i++){if (b[i].nodeType==1){var name = b[i].tagName;if (typeof z[name] != "undefined"){if (!(z[name] instanceof Array))
 z[name]=[z[name]];z[name].push(this.tagToObject(b[i],{}));}
 else
 z[b[i].tagName]=this.tagToObject(b[i],{});flag=true;}
 }
 
 if (!flag)return this.nodeValue(tag);z.value = this.nodeValue(tag);return z;},
 
 nodeValue:function(node){if (node.firstChild)return node.firstChild.data;return "";},
 
 fromString:function(xmlString){if (window.DOMParser && !dhtmlx._isIE)return (new DOMParser()).parseFromString(xmlString,"text/xml");if (window.ActiveXObject){var temp=new ActiveXObject("Microsoft.xmlDOM");temp.loadXML(xmlString);return temp;}
 dhtmlx.error("Load from xml string is not supported");},
 
 checkResponse:function(text,xml){if (xml && ( xml.firstChild && xml.firstChild.tagName != "parsererror"))
 return xml;var a=this.fromString(text.replace(/^[\s]+/,""));if (a)return a;dhtmlx.error("xml can't be parsed",text);}
};dhtmlx.DataLoader={_init:function(config){config = config || "";this.name = "DataStore";this.data = (config.datastore)||(new dhtmlx.DataStore());this._readyHandler = this.data.attachEvent("onStoreLoad",dhtmlx.bind(this._call_onready,this));},
 
 load:function(url,call){dhtmlx.AtomDataLoader.load.apply(this, arguments);if (!this.data.feed)this.data.feed = function(from,count){if (this._load_count)return this._load_count=[from,count];else
 this._load_count=true;this.load(url+((url.indexOf("?")==-1)?"?":"&")+"posStart="+from+"&count="+count,function(){var temp = this._load_count;this._load_count = false;if (typeof temp =="object")this.data.feed.apply(this, temp);});};},
 
 _onLoad:function(text,xml,loader){this.data._parse(this.data.driver.toObject(text,xml));this.callEvent("onXLE",[]);if(this._readyHandler){this.data.detachEvent(this._readyHandler);this._readyHandler = null;}
 },
 dataFeed_setter:function(value){this.data.attachEvent("onBeforeFilter", dhtmlx.bind(function(text, value){if (this._settings.dataFeed){var filter = {};if (!text && !filter)return;if (typeof text == "function"){if (!value)return;text(value, filter);}else 
 filter = {text:value };this.clearAll();var url = this._settings.dataFeed;if (typeof url == "function")return url.call(this, value, filter);var urldata = [];for (var key in filter)urldata.push("dhx_filter["+key+"]="+encodeURIComponent(filter[key]));this.load(url+(url.indexOf("?")<0?"?":"&")+urldata.join("&"), this._settings.datatype);return false;}
 },this));return value;},
 _call_onready:function(){if (this._settings.ready){var code = dhtmlx.toFunctor(this._settings.ready);if (code && code.call)code.apply(this, arguments);}
 }
};dhtmlx.DataStore = function(){this.name = "DataStore";dhtmlx.extend(this, dhtmlx.EventSystem);this.setDriver("xml");this.pull = {};this.order = dhtmlx.toArray();};dhtmlx.DataStore.prototype={setDriver:function(type){dhtmlx.assert(dhtmlx.DataDriver[type],"incorrect DataDriver");this.driver = dhtmlx.DataDriver[type];},
 
 _parse:function(data){this.callEvent("onParse", [this.driver, data]);if (this._filter_order)this.filter();var info = this.driver.getInfo(data);if (info._key)dhtmlx.security_key = info._key;var recs = this.driver.getRecords(data);var from = (info._from||0)*1;if (from === 0 && this.order[0])from = this.order.length;var j=0;for (var i=0;i<recs.length;i++){var temp = this.driver.getDetails(recs[i]);var id = this.id(temp);if (!this.pull[id]){this.order[j+from]=id;j++;}
 this.pull[id]=temp;if (this.extraParser)this.extraParser(temp);if (this._scheme){if (this._scheme.$init)this._scheme.$update(temp);else if (this._scheme.$update)this._scheme.$update(temp);}
 }
 
 for (var i=0;i < info._size;i++)if (!this.order[i]){var id = dhtmlx.uid();var temp = {id:id, $template:"loading"};this.pull[id]=temp;this.order[i]=id;}
 this.callEvent("onStoreLoad",[this.driver, data]);this.refresh();},
 
 id:function(data){return data.id||(data.id=dhtmlx.uid());},
 changeId:function(old, newid){dhtmlx.assert(this.pull[old],"Can't change id, for non existing item: "+old);this.pull[newid] = this.pull[old];this.pull[newid].id = newid;this.order[this.order.find(old)]=newid;if (this._filter_order)this._filter_order[this._filter_order.find(old)]=newid;this.callEvent("onIdChange", [old, newid]);if (this._render_change_id)this._render_change_id(old, newid);},
 get:function(id){return this.item(id);},
 set:function(id, data){return this.update(id, data);},
 
 item:function(id){return this.pull[id];},
 
 update:function(id,data){if (this._scheme && this._scheme.$update)this._scheme.$update(data);if (this.callEvent("onBeforeUpdate", [id, data])=== false) return false;this.pull[id]=data;this.refresh(id);},
 
 refresh:function(id){if (this._skip_refresh)return;if (id)this.callEvent("onStoreUpdated",[id, this.pull[id], "update"]);else
 this.callEvent("onStoreUpdated",[null,null,null]);},
 silent:function(code){this._skip_refresh = true;code.call(this);this._skip_refresh = false;},
 
 getRange:function(from,to){if (from)from = this.indexById(from);else 
 from = this.startOffset||0;if (to)to = this.indexById(to);else {to = Math.min((this.endOffset||Infinity),(this.dataCount()-1));if (to<0)to = 0;}
 if (from>to){var a=to;to=from;from=a;}
 
 return this.getIndexRange(from,to);},
 
 getIndexRange:function(from,to){to=Math.min((to||Infinity),this.dataCount()-1);var ret=dhtmlx.toArray();for (var i=(from||0);i <= to;i++)
 ret.push(this.item(this.order[i]));return ret;},
 
 dataCount:function(){return this.order.length;},
 
 exists:function(id){return !!(this.pull[id]);},
 
 
 move:function(sindex,tindex){if (sindex<0 || tindex<0){dhtmlx.error("DataStore::move","Incorrect indexes");return;}
 
 var id = this.idByIndex(sindex);var obj = this.item(id);this.order.removeAt(sindex);this.order.insertAt(id,Math.min(this.order.length, tindex));this.callEvent("onStoreUpdated",[id,obj,"move"]);},
 scheme:function(config){this._scheme = config;},
 sync:function(source, filter, silent){if (typeof filter != "function"){silent = filter;filter = null;}
 
 if (dhtmlx.debug_bind){this.debug_sync_master = source;dhtmlx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id);}
 
 var topsource = source;if (source.name != "DataStore")source = source.data;var sync_logic = dhtmlx.bind(function(id, data, mode){if (mode != "update" || filter)id = null;if (!id){this.order = dhtmlx.toArray([].concat(source.order));this._filter_order = null;this.pull = source.pull;if (filter)this.silent(filter);if (this._on_sync)this._on_sync();}
 if (dhtmlx.debug_bind)dhtmlx.log("[sync:request] "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id + " <= "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id);if (!silent)this.refresh(id);else
 silent = false;}, this);source.attachEvent("onStoreUpdated", sync_logic);this.feed = function(from, count){topsource.loadNext(count, from);};sync_logic();},
 
 add:function(obj,index){if (this._scheme){obj = obj||{};for (var key in this._scheme)obj[key] = obj[key]||this._scheme[key];if (this._scheme){if (this._scheme.$init)this._scheme.$update(obj);else if (this._scheme.$update)this._scheme.$update(obj);}
 }
 
 
 var id = this.id(obj);var data_size = this.dataCount();if (dhtmlx.isNotDefined(index)|| index < 0)
 index = data_size;if (index > data_size){dhtmlx.log("Warning","DataStore:add","Index of out of bounds");index = Math.min(this.order.length,index);}
 if (this.callEvent("onBeforeAdd", [id, obj, index])=== false) return false;if (this.exists(id)) return dhtmlx.error("Not unique ID");this.pull[id]=obj;this.order.insertAt(id,index);if (this._filter_order){var original_index = this._filter_order.length;if (!index && this.order.length)original_index = 0;this._filter_order.insertAt(id,original_index);}
 this.callEvent("onafterAdd",[id,index]);this.callEvent("onStoreUpdated",[id,obj,"add"]);return id;},
 
 
 remove:function(id){if (id instanceof Array){for (var i=0;i < id.length;i++)this.remove(id[i]);return;}
 if (this.callEvent("onBeforeDelete",[id])=== false) return false;if (!this.exists(id)) return dhtmlx.error("Not existing ID",id);var obj = this.item(id);this.order.remove(id);if (this._filter_order)this._filter_order.remove(id);delete this.pull[id];this.callEvent("onafterdelete",[id]);this.callEvent("onStoreUpdated",[id,obj,"delete"]);},
 
 clearAll:function(){this.pull = {};this.order = dhtmlx.toArray();this.feed = null;this._filter_order = null;this.callEvent("onClearAll",[]);this.refresh();},
 
 idByIndex:function(index){if (index>=this.order.length || index<0)dhtmlx.log("Warning","DataStore::idByIndex Incorrect index");return this.order[index];},
 
 indexById:function(id){var res = this.order.find(id);return res;},
 
 next:function(id,step){return this.order[this.indexById(id)+(step||1)];},
 
 first:function(){return this.order[0];},
 
 last:function(){return this.order[this.order.length-1];},
 
 previous:function(id,step){return this.order[this.indexById(id)-(step||1)];},
 
 sort:function(by, dir, as){var sort = by;if (typeof by == "function")sort = {as:by, dir:dir};else if (typeof by == "string")sort = {by:by, dir:dir, as:as};var parameters = [sort.by, sort.dir, sort.as];if (!this.callEvent("onbeforesort",parameters)) return;if (this.order.length){var sorter = dhtmlx.sort.create(sort);var neworder = this.getRange(this.first(), this.last());neworder.sort(sorter);this.order = neworder.map(function(obj){return this.id(obj);},this);}
 
 
 this.refresh();this.callEvent("onaftersort",parameters);},
 
 filter:function(text,value){if (!this.callEvent("onBeforeFilter", [text, value])) return;if (this._filter_order){this.order = this._filter_order;delete this._filter_order;}
 
 if (!this.order.length)return;if (text){var filter = text;value = value||"";if (typeof text == "string"){text = dhtmlx.Template.fromHTML(text);value = value.toString().toLowerCase();filter = function(obj,value){return text(obj).toLowerCase().indexOf(value)!=-1;};}
 
 
 var neworder = dhtmlx.toArray();for (var i=0;i < this.order.length;i++){var id = this.order[i];if (filter(this.item(id),value))
 neworder.push(id);}
 
 this._filter_order = this.order;this.order = neworder;}
 
 this.refresh();this.callEvent("onAfterFilter", []);},
 
 each:function(method,master){for (var i=0;i<this.order.length;i++)method.call((master||this), this.item(this.order[i]));},
 
 provideApi:function(target,eventable){this.debug_bind_master = target;if (eventable){this.mapEvent({onbeforesort: target,
 onaftersort: target,
 onbeforeadd: target,
 onafteradd: target,
 onbeforedelete: target,
 onafterdelete: target,
 onbeforeupdate: target
 });}
 
 var list = ["get","set","sort","add","remove","exists","idByIndex","indexById","item","update","refresh","dataCount","filter","next","previous","clearAll","first","last","serialize"];for (var i=0;i < list.length;i++)target[list[i]]=dhtmlx.methodPush(this,list[i]);if (dhtmlx.assert_enabled()) 
 this.assert_event(target);},
 
 serialize: function(){var ids = this.order;var result = [];for(var i=0;i< ids.length;i++)result.push(this.pull[ids[i]]);return result;}
};dhtmlx.sort = {create:function(config){return dhtmlx.sort.dir(config.dir, dhtmlx.sort.by(config.by, config.as));},
 as:{"int":function(a,b){a = a*1;b=b*1;return a>b?1:(a<b?-1:0);},
 "string_strict":function(a,b){a = a.toString();b=b.toString();return a>b?1:(a<b?-1:0);},
 "string":function(a,b){a = a.toString().toLowerCase();b=b.toString().toLowerCase();return a>b?1:(a<b?-1:0);}
 },
 by:function(prop, method){if (!prop)return method;if (typeof method != "function")method = dhtmlx.sort.as[method||"string"];prop = dhtmlx.Template.fromHTML(prop);return function(a,b){return method(prop(a),prop(b));};},
 dir:function(prop, method){if (prop == "asc")return method;return function(a,b){return method(a,b)*-1;};}
};dhtmlx.Group = {_init:function(){dhtmlx.assert(this.data,"DataStore required for grouping");this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(){if (this._settings.group)this.group(this._settings.group,false);},this));this.attachEvent("onBeforeRender",dhtmlx.bind(function(data){if (this._settings.sort){data.block();data.sort(this._settings.sort);data.unblock();}
 },this));this.attachEvent("onBeforeSort",dhtmlx.bind(function(){this._settings.sort = null;},this));},
 _init_group_data_event:function(data,master){data.attachEvent("onClearAll",dhtmlx.bind(function(){this.ungroup(false);this.block();this.clearAll();this.unblock();},master));},
 sum:function(property, data){property = dhtmlx.Template.setter(property);data = data || this.data;var summ = 0;data.each(function(obj){summ+=property(obj)*1;});return summ;},
 min:function(property, data){property = dhtmlx.Template.setter(property);data = data || this.data;var min = Infinity;data.each(function(obj){if (property(obj)*1 < min) min = property(obj)*1;});return min*1;},
 max:function(property, data){property = dhtmlx.Template.setter(property);data = data || this.data;var max = -Infinity;data.each(function(obj){if (property(obj)*1 > max) max = property(obj)*1;});return max;},
 _split_data_by:function(stats){var any=function(property, data){property = dhtmlx.Template.setter(property);return property(data[0]);};var key = dhtmlx.Template.setter(stats.by);if (!stats.map[key])stats.map[key] = [key, any];var groups = {};var labels = [];this.data.each(function(data){var current = key(data);if (!groups[current]){labels.push({id:current});groups[current] = dhtmlx.toArray();}
 groups[current].push(data);});for (var prop in stats.map){var functor = (stats.map[prop][1]||any);if (typeof functor != "function")functor = this[functor];for (var i=0;i < labels.length;i++){labels[i][prop]=functor.call(this, stats.map[prop][0], groups[labels[i].id]);}
 }
 
 this._not_grouped_data = this.data;this.data = new dhtmlx.DataStore();this.data.provideApi(this,true);this._init_group_data_event(this.data, this);this.parse(labels,"json");},
 group:function(config,mode){this.ungroup(false);this._split_data_by(config);if (mode!==false)this.render();},
 ungroup:function(mode){if (this._not_grouped_data){this.data = this._not_grouped_data;this.data.provideApi(this, true);}
 if (mode!==false)this.render();},
 group_setter:function(config){dhtmlx.assert(typeof config == "object", "Incorrect group value");dhtmlx.assert(config.by,"group.by is mandatory");dhtmlx.assert(config.map,"group.map is mandatory");return config;},
 
 sort_setter:function(config){if (typeof config != "object")config = {by:config };this._mergeSettings(config,{as:"string",
 dir:"asc"
 });return config;}
};dhtmlx.KeyEvents = {_init:function(){dhtmlx.event(this._obj,"keypress",this._onKeyPress,this);},
 
 _onKeyPress:function(e){e=e||event;var code = e.which||e.keyCode;this.callEvent((this._edit_id?"onEditKeyPress":"onKeyPress"),[code,e.ctrlKey,e.shiftKey,e]);}
};dhtmlx.MouseEvents={_init: function(){if (this.on_click){dhtmlx.event(this._obj,"click",this._onClick,this);dhtmlx.event(this._obj,"contextmenu",this._onContext,this);}
 if (this.on_dblclick)dhtmlx.event(this._obj,"dblclick",this._onDblClick,this);if (this.on_mouse_move){dhtmlx.event(this._obj,"mousemove",this._onMouse,this);dhtmlx.event(this._obj,(dhtmlx._isIE?"mouseleave":"mouseout"),this._onMouse,this);}
 },
 
 _onClick: function(e) {return this._mouseEvent(e,this.on_click,"ItemClick");},
 
 _onDblClick: function(e) {return this._mouseEvent(e,this.on_dblclick,"ItemDblClick");},
 
 _onContext: function(e) {var id = dhtmlx.html.locate(e, this._id);if (id && !this.callEvent("onBeforeContextMenu", [id,e]))
 return dhtmlx.html.preventEvent(e);},
 
 _onMouse:function(e){if (dhtmlx._isIE)e = document.createEventObject(event);if (this._mouse_move_timer)window.clearTimeout(this._mouse_move_timer);this.callEvent("onMouseMoving",[e]);this._mouse_move_timer = window.setTimeout(dhtmlx.bind(function(){if (e.type == "mousemove")this._onMouseMove(e);else
 this._onMouseOut(e);},this),500);},
 
 _onMouseMove: function(e) {if (!this._mouseEvent(e,this.on_mouse_move,"MouseMove"))
 this.callEvent("onMouseOut",[e||event]);},
 
 _onMouseOut: function(e) {this.callEvent("onMouseOut",[e||event]);},
 
 _mouseEvent:function(e,hash,name){e=e||event;var trg=e.target||e.srcElement;var css = "";var id = null;var found = false;while (trg && trg.parentNode){if (!found && trg.getAttribute){id = trg.getAttribute(this._id);if (id){if (trg.getAttribute("userdata"))
 this.callEvent("onLocateData",[id,trg]);if (!this.callEvent("on"+name,[id,e,trg])) return;found = true;}
 }
 css=trg.className;if (css){css = css.split(" ");css = css[0]||css[1];if (hash[css])return hash[css].call(this,e,id||dhx.html.locate(e, this._id),trg);}
 trg=trg.parentNode;}
 return found;}
};dhtmlx.Settings={_init:function(){this._settings = this.config= {};},
 define:function(property, value){if (typeof property == "object")return this._parseSeetingColl(property);return this._define(property, value);},
 _define:function(property,value){dhtmlx.assert_settings.call(this,property,value);var setter = this[property+"_setter"];return this._settings[property]=setter?setter.call(this,value):value;},
 
 _parseSeetingColl:function(coll){if (coll){for (var a in coll)this._define(a,coll[a]);}
 },
 
 _parseSettings:function(obj,initial){var settings = dhtmlx.extend({},initial);if (typeof obj == "object" && !obj.tagName)dhtmlx.extend(settings,obj);this._parseSeetingColl(settings);},
 _mergeSettings:function(config, defaults){for (var key in defaults)switch(typeof config[key]){case "object": 
 config[key] = this._mergeSettings((config[key]||{}), defaults[key]);break;case "undefined":
 config[key] = defaults[key];break;default: 
 break;}
 return config;},
 
 _parseContainer:function(obj,name,fallback){if (typeof obj == "object" && !obj.tagName)obj=obj.container;this._obj = dhtmlx.toNode(obj);if (!this._obj && fallback)this._obj = fallback(obj);dhtmlx.assert(this._obj, "Incorrect html container");this._obj.className+=" "+name;this._obj.onselectstart=function(){return false;};this._dataobj = this._obj;},
 
 _set_type:function(name){if (typeof name == "object")return this.type_setter(name);dhtmlx.assert(this.types, "RenderStack :: Types are not defined");dhtmlx.assert(this.types[name],"RenderStack :: Inccorect type name",name);this.type=dhtmlx.extend({},this.types[name]);this.customize();},
 customize:function(obj){if (obj)dhtmlx.extend(this.type,obj);this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type));this.type._item_end = this.template_item_end(this.type);this.render();},
 
 type_setter:function(value){this._set_type(typeof value == "object"?dhtmlx.Type.add(this,value):value);return value;},
 
 template_setter:function(value){return this.type_setter({template:value});},
 
 css_setter:function(value){this._obj.className += " "+value;return value;}
};dhtmlx.compat=function(name, obj){if (dhtmlx.compat[name])dhtmlx.compat[name](obj);};(function(){if (!window.dhtmlxError){var dummy = function(){};window.dhtmlxError={catchError:dummy, throwError:dummy };window.convertStringToBoolean=function(value){return !!value;};window.dhtmlxEventable = function(node){dhtmlx.extend(node,dhtmlx.EventSystem);};var loader = {getXMLTopNode:function(name){},
 doXPath:function(path){return dhtmlx.DataDriver.xml.xpath(this.xml,path);},
 xmlDoc:{responseXML:true
 }
 };dhtmlx.compat.dataProcessor=function(obj){var sendData = "_sendData";var in_progress = "_in_progress";var tMode = "_tMode";var waitMode = "_waitMode";obj[sendData]=function(a1,rowId){if (!a1)return;if (rowId)this[in_progress][rowId]=(new Date()).valueOf();if (!this.callEvent("onBeforeDataSending",rowId?[rowId,this.getState(rowId)]:[])) return false;var a2 = this;var a3=this.serverProcessor;if (this[tMode]!="POST")dhtmlx.ajax().get(a3+((a3.indexOf("?")!=-1)?"&":"?")+this.serialize(a1,rowId),"",function(t,x,xml){loader.xml = dhtmlx.DataDriver.xml.checkResponse(t,x);a2.afterUpdate(a2, null, null, null, loader);});else
 dhtmlx.ajax().post(a3,this.serialize(a1,rowId),function(t,x,xml){loader.xml = dhtmlx.DataDriver.xml.checkResponse(t,x);a2.afterUpdate(a2, null, null, null, loader);});this[waitMode]++;};};}
 
})();if (!dhtmlx.attaches)dhtmlx.attaches = {};dhtmlx.attaches.attachAbstract=function(name, conf){var obj = document.createElement("DIV");obj.id = "CustomObject_"+dhtmlx.uid();obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "grid";document.body.appendChild(obj);this.attachObject(obj.id);conf.container = obj.id;var that = this.vs[this.av];that.grid = new window[name](conf);that.gridId = obj.id;that.gridObj = obj;that.grid.setSizes = function(){if (this.resize)this.resize();else this.render();};var method_name="_viewRestore";return this.vs[this[method_name]()].grid;};dhtmlx.attaches.attachDataView = function(conf){return this.attachAbstract("dhtmlXDataView",conf);};dhtmlx.attaches.attachChart = function(conf){return this.attachAbstract("dhtmlXChart",conf);};dhtmlx.compat.layout = function(){};dhtmlx.DataDriver.dhtmlxgrid={_grid_getter:"_get_cell_value",
 toObject:function(data){this._grid = data;return data;},
 getRecords:function(data){return data.rowsBuffer;},
 getDetails:function(data){var result = {};for (var i=0;i < this._grid.getColumnsNum();i++)
 result["data"+i]=this._grid[this._grid_getter](data,i);return result;},
 getInfo:function(data){return {_size:0,
 _from:0
 };}
};dhtmlx.Canvas = {_init:function(){this._canvas_labels = [];},
 _prepareCanvas:function(container){this._canvas = dhtmlx.html.create("canvas",{width:container.offsetWidth, height:container.offsetHeight });container.appendChild(this._canvas);if (!this._canvas.getContext){if (dhtmlx._isIE){dhtmlx.require("thirdparty/excanvas/excanvas.js");G_vmlCanvasManager.init_(document);G_vmlCanvasManager.initElement(this._canvas);}else 
 dhtmlx.error("Canvas is not supported in the current browser");}
 return this._canvas;}, 
 getCanvas:function(context){return (this._canvas||this._prepareCanvas(this._obj)).getContext(context||"2d");},
 _resizeCanvas:function(){if (this._canvas){this._canvas.setAttribute("width", this._canvas.parentNode.offsetWidth);this._canvas.setAttribute("height", this._canvas.parentNode.offsetHeight);}
 },
 renderText:function(x,y,text,css,w){if (!text)return;var t = dhtmlx.html.create("DIV",{"class":"dhx_canvas_text"+(css?(" "+css):""),
 "style":"left:"+x+"px;top:"+y+"px;"
 },text);this._obj.appendChild(t);this._canvas_labels.push(t);if (w)t.style.width = w+"px";return t;},
 renderTextAt:function(valign,align, x,y,t,c,w){var text=this.renderText.call(this,x,y,t,c,w);if (text){if (valign){if(valign == "middle")text.style.top = parseInt(y-text.offsetHeight/2,10) + "px";else
 text.style.top = y-text.offsetHeight + "px";}
 if (align){if(align == "left")text.style.left = x-text.offsetWidth + "px";else
 text.style.left = parseInt(x-text.offsetWidth/2,10) + "px";}
 }
 return text;},
 clearCanvas:function(){for(var i=0;i < this._canvas_labels.length;i++)this._obj.removeChild(this._canvas_labels[i]);this._canvas_labels = [];if (this._obj._htmlmap){this._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap);this._obj._htmlmap = null;}
 
 this.getCanvas().clearRect(0,0,this._canvas.offsetWidth, this._canvas.offsetHeight);}
};dhtmlXChart = function(container){this.name = "Chart";this.version = "3.0";if (dhtmlx.assert_enabled()) this._assert();dhtmlx.extend(this, dhtmlx.Settings);this._parseContainer(container,"dhx_chart");dhtmlx.extend(this, dhtmlx.AtomDataLoader);dhtmlx.extend(this, dhtmlx.DataLoader);this.data.provideApi(this,true);dhtmlx.extend(this, dhtmlx.EventSystem);dhtmlx.extend(this, dhtmlx.MouseEvents);dhtmlx.extend(this, dhtmlx.Destruction);dhtmlx.extend(this, dhtmlx.Canvas);dhtmlx.extend(this, dhtmlx.Group);dhtmlx.extend(this, dhtmlx.AutoTooltip);for (var key in dhtmlx.chart)dhtmlx.extend(this, dhtmlx.chart[key]);if(container.preset){this.definePreset(container);}
 this._parseSettings(container,this.defaults);this._series = [this._settings];this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render();},this));this.attachEvent("onLocateData", this._switchSerie);};dhtmlXChart.prototype={_id:"dhx_area_id",
 on_click:{},
 on_dblclick:{},
 on_mouse_move:{},
 bind:function(){dhx.BaseBind.legacyBind.apply(this, arguments);},
 sync:function(){dhx.BaseBind.legacySync.apply(this, arguments);},
 resize:function(){this._resizeCanvas();this.render();},
 view_setter:function( val){if (!dhtmlx.chart[val])dhtmlx.error("Chart type extension is not loaded: "+val);if (typeof this._settings.offset == "undefined"){this._settings.offset = !(val == "area" || val == "stackedArea");}
 if(val=="radar"&&!this._settings.yAxis)this.define("yAxis",{});if(val=="scatter"){if(!this._settings.yAxis)this.define("yAxis",{});if(!this._settings.xAxis)this.define("xAxis",{});}
 return val;},
 render:function(){if (!this.callEvent("onBeforeRender",[this.data]))
 return;this.clearCanvas();if(this._settings.legend){this._drawLegend(this.getCanvas(),
 this.data.getRange(),
 this._obj.offsetWidth
 );}
 var bounds = this._getChartBounds(this._obj.offsetWidth,this._obj.offsetHeight);var map = new dhtmlx.ui.Map(this._id);var temp = this._settings;for(var i=0;i < this._series.length;i++){this._settings = this._series[i];this["pvt_render_"+this._settings.view](
 this.getCanvas(),
 this.data.getRange(),
 bounds.start,
 bounds.end,
 i,
 map
 );}
 map.render(this._obj);this._settings = temp;},
 value_setter:dhtmlx.Template.obj_setter,
 xValue_setter:dhtmlx.Template.obj_setter,
 yValue_setter:function(config){this.define("value",config);},
 alpha_setter:dhtmlx.Template.obj_setter, 
 label_setter:dhtmlx.Template.obj_setter,
 lineColor_setter:dhtmlx.Template.obj_setter, 
 pieInnerText_setter:dhtmlx.Template.obj_setter,
 gradient_setter:function(config){if((typeof(config)!="function")&&config&&(config === true))
 config = "light";return config;},
 colormap:{"RAINBOW":function(obj){var pos = Math.floor(this.indexById(obj.id)/this.dataCount()*1536);if (pos==1536)pos-=1;return this._rainbow[Math.floor(pos/256)](pos%256);}
 },
 color_setter:function(value){return this.colormap[value]||dhtmlx.Template.obj_setter( value);},
 fill_setter:function(value){return ((!value||value==0)?false:dhtmlx.Template.obj_setter( value));},
 definePreset:function(obj){this.define("preset",obj.preset);delete obj.preset;},
 preset_setter:function(value){var a, b, preset;this.defaults = dhtmlx.extend({},this.defaults);if(typeof dhtmlx.presets.chart[value]=="object"){preset = dhtmlx.presets.chart[value];for(a in preset){if(typeof preset[a]=="object"){if(!this.defaults[a]||typeof this.defaults[a]!="object"){this.defaults[a] = dhtmlx.extend({},preset[a]);}
 else{this.defaults[a] = dhtmlx.extend({},this.defaults[a]);for(b in preset[a]){this.defaults[a][b] = preset[a][b];}
 }
 }else{this.defaults[a] = preset[a];}
 }
 return value;}
 return false;},
 legend_setter:function( config){if(!config){if(this.legendObj){this.legendObj.innerHTML = "";this.legendObj = null;}
 return false;}
 if(typeof(config)!="object") 
 config={template:config};this._mergeSettings(config,{width:150,
 height:18,
 layout:"y",
 align:"left",
 valign:"bottom",
 template:"",
 marker:{type:"square",
 width:15,
 height:15,
 radius:3
 },
 margin: 4,
 padding: 3
 });config.template = dhtmlx.Template.setter(config.template);return config;},
 defaults:{color:"RAINBOW",
 alpha:"1",
 label:false,
 value:"{obj.value}",
 padding:{},
 view:"pie",
 lineColor:"#ffffff",
 cant:0.5,
 width: 30,
 labelWidth:100,
 line:{width:2,
 color:"#1293f8"
 },
 item:{radius:3,
 borderColor:"#636363",
 borderWidth:1,
 color: "#ffffff",
 alpha:1,
 type:"r",
 shadow:false
 },
 shadow:true,
 gradient:false,
 border:true,
 labelOffset: 20,
 origin:"auto"
 },
 item_setter:function( config){if(typeof(config)!="object")
 config={color:config, borderColor:config};this._mergeSettings(config,dhtmlx.extend({},this.defaults.item));config.alpha = dhtmlx.Template.setter(config.alpha);config.borderColor = dhtmlx.Template.setter(config.borderColor);config.color = dhtmlx.Template.setter(config.color);config.radius = dhtmlx.Template.setter(config.radius);return config;},
 line_setter:function( config){if(typeof(config)!="object")
 config={color:config};dhtmlx.extend(this.defaults.line,config);config = dhtmlx.extend({},this.defaults.line);config.color = dhtmlx.Template.setter(config.color);return config;},
 padding_setter:function( config){if(typeof(config)!="object")
 config={left:config, right:config, top:config, bottom:config};this._mergeSettings(config,{left:50,
 right:20,
 top:35,
 bottom:40
 });return config;},
 xAxis_setter:function( config){if(!config)return false;if(typeof(config)!="object")
 config={template:config };this._mergeSettings(config,{title:"",
 color:"#000000",
 lineColor:"#cfcfcf",
 template:"{obj}",
 lines:true
 });var templates = ["lineColor","template","lines"];this._converToTemplate(templates,config);this._settings.configXAxis = dhtmlx.extend({},config);return config;},
 yAxis_setter:function( config){this._mergeSettings(config,{title:"",
 color:"#000000",
 lineColor:"#cfcfcf",
 template:"{obj}",
 lines:true,
 bg:"#ffffff"
 });var templates = ["lineColor","template","lines","bg"];this._converToTemplate(templates,config);this._settings.configYAxis = dhtmlx.extend({},config);return config;},
 _converToTemplate:function(arr,config){for(var i=0;i< arr.length;i++){config[arr[i]] = dhtmlx.Template.setter(config[arr[i]]);}
 },
 _drawScales:function(ctx,data,point0,point1,start,end,cellWidth){var y = this._drawYAxis(ctx,data,point0,point1,start,end);this._drawXAxis(ctx,data,point0,point1,cellWidth,y);return y;},
 _drawXAxis:function(ctx,data,point0,point1,cellWidth,y){if (!this._settings.xAxis)return;var x0 = point0.x-0.5;var y0 = parseInt((y?y:point1.y),10)+0.5;var x1 = point1.x;var unit_pos;var center = true;this._drawLine(ctx,x0,y0,x1,y0,this._settings.xAxis.color,1);for(var i=0;i < data.length;i ++){if(this._settings.offset === true)unit_pos = x0+cellWidth/2+i*cellWidth;else{unit_pos = (i==data.length-1)?point1.x:x0+i*cellWidth;center = !!i;}
 unit_pos = parseInt(unit_pos,10)-0.5;var top = ((this._settings.origin!="auto")&&(this._settings.view=="bar")&&(parseFloat(this._settings.value(data[i]))<this._settings.origin));this._drawXAxisLabel(unit_pos,y0,data[i],center,top);if((this._settings.offset||i)&&this._settings.xAxis.lines.call(this,data[i]))
 this._drawXAxisLine(ctx,unit_pos,point1.y,point0.y,data[i]);}
 
 this.renderTextAt(true, false, x0,point1.y+this._settings.padding.bottom-3,
 this._settings.xAxis.title,
 "dhx_axis_title_x",
 point1.x - point0.x
 );if (!this._settings.xAxis.lines.call(this,{})|| !this._settings.offset) return;this._drawLine(ctx,x1+0.5,point1.y,x1+0.5,point0.y+0.5,this._settings.xAxis.color,0.2);},
 _drawYAxis:function(ctx,data,point0,point1,start,end){var step;var scaleParam= {};if (!this._settings.yAxis)return;var x0 = point0.x - 0.5;var y0 = point1.y;var y1 = point0.y;var lineX = point1.y;if(this._settings.yAxis.step)step = parseFloat(this._settings.yAxis.step);if(typeof this._settings.configYAxis.step =="undefined"||typeof this._settings.configYAxis.start=="undefined"||typeof this._settings.configYAxis.end =="undefined"){scaleParam = this._calculateScale(start,end);start = scaleParam.start;end = scaleParam.end;step = scaleParam.step;this._settings.yAxis.end = end;this._settings.yAxis.start = start;}
 this._setYAxisTitle(point0,point1);if(step===0)return;if(end==start){return y0;}
 var stepHeight = (y0-y1)*step/(end-start);var c = 0;for(var i = start;i<=end;i += step){if(scaleParam.fixNum)i = parseFloat((new Number(i)).toFixed(scaleParam.fixNum));var yi = Math.floor(y0-c*stepHeight)+ 0.5;if(!(i==start&&this._settings.origin=="auto")&&this._settings.yAxis.lines(i))
 this._drawLine(ctx,x0,yi,point1.x,yi,this._settings.yAxis.lineColor(i),1);if(i == this._settings.origin)lineX = yi;var label = i;if(step<1){var power = Math.min(this._log10(step),(start<=0?0:this._log10(start)));var corr = Math.pow(10,-power);label = Math.round(i*corr)/corr;i = label;}
 this.renderText(0,yi-5,
 this._settings.yAxis.template(label.toString()),
 "dhx_axis_item_y",
 point0.x-5
 );c++;}
 this._drawLine(ctx,x0,y0+1,x0,y1,this._settings.yAxis.color,1);return lineX;},
 _setYAxisTitle:function(point0,point1){var className = "dhx_axis_title_y"+(dhtmlx._isIE&&dhtmlx._isIE !=9?" dhx_ie_filter":"");var text=this.renderTextAt("middle",false,0,parseInt((point1.y-point0.y)/2+point0.y,10),this._settings.yAxis.title,className);if (text)text.style.left = (dhtmlx.env.transform?(text.offsetHeight-text.offsetWidth)/2:0)+"px";},
 _calculateScale:function(nmin,nmax){if(this._settings.origin!="auto"&&this._settings.origin<nmin)nmin = this._settings.origin;var step,start,end;step = ((nmax-nmin)/8)||1;var power = Math.floor(this._log10(step));var calculStep = Math.pow(10,power);var stepVal = step/calculStep;stepVal = (stepVal>5?10:5);step = parseInt(stepVal,10)*calculStep;if(step>Math.abs(nmin))
 start = (nmin<0?-step:0);else{var absNmin = Math.abs(nmin);var powerStart = Math.floor(this._log10(absNmin));var nminVal = absNmin/Math.pow(10,powerStart);start = Math.ceil(nminVal*10)/10*Math.pow(10,powerStart)-step;if(absNmin>1&&step>0.1){start = Math.ceil(start);}
 while(nmin<0?start<=nmin:start>=nmin)start -= step;if(nmin<0)start =-start-2*step;}
 end = start;while(end<nmax){end += step;end = parseFloat((new Number(end)).toFixed(Math.abs(power)));}
 return {start:start,end:end,step:step,fixNum:Math.abs(power) };},
 _getLimits:function(orientation,value){var maxValue,minValue;var axis = ((arguments.length && orientation=="h")?this._settings.configXAxis:this._settings.configYAxis);if(axis&&(typeof axis.end!="undefined")&&(typeof axis.start!="undefined")&&axis.step){maxValue = parseFloat(axis.end);minValue = parseFloat(axis.start);}
 else{maxValue = this.max(this._series[0][value||"value"]);minValue = (axis&&(typeof axis.start!="undefined"))?parseFloat(axis.start):this.min(this._series[0][value||"value"]);if(this._series.length>1)for(var i=1;i < this._series.length;i++){var maxI = this.max(this._series[i][value||"value"]);var minI = this.min(this._series[i][value||"value"]);if (maxI > maxValue)maxValue = maxI;if (minI < minValue)minValue = minI;}
 }
 return {max:maxValue,min:minValue};},
 _log10:function(n){var method_name="log";return Math.floor((Math[method_name](n)/Math.LN10));},
 _drawXAxisLabel:function(x,y,obj,center,top){if (!this._settings.xAxis)return;var elem = this.renderTextAt(top, center, x,y-(top?2:0),this._settings.xAxis.template(obj));if (elem)elem.className += " dhx_axis_item_x";},
 _drawXAxisLine:function(ctx,x,y1,y2,obj){if (!this._settings.xAxis||!this._settings.xAxis.lines)return;this._drawLine(ctx,x,y1,x,y2,this._settings.xAxis.lineColor.call(this,obj),1);},
 _drawLine:function(ctx,x1,y1,x2,y2,color,width){ctx.strokeStyle = color;ctx.lineWidth = width;ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.stroke();ctx.lineWidth = 1;},
 _getRelativeValue:function(minValue,maxValue){var relValue, origRelValue;var valueFactor = 1;if(maxValue != minValue){origRelValue = maxValue - minValue;if(Math.abs(relValue)< 1){while(Math.abs(relValue)<1){valueFactor *= 10;origRelValue = relValue* valueFactor;}
 }
 relValue = origRelValue;}
 else relValue = minValue;return [relValue,valueFactor];},
 _rainbow : [
 function(pos){return "#FF"+dhtmlx.math.toHex(pos/2,2)+"00";},
 function(pos){return "#FF"+dhtmlx.math.toHex(pos/2+128,2)+"00";},
 function(pos){return "#"+dhtmlx.math.toHex(255-pos,2)+"FF00";},
 function(pos){return "#00FF"+dhtmlx.math.toHex(pos,2);},
 function(pos){return "#00"+dhtmlx.math.toHex(255-pos,2)+"FF";},
 function(pos){return "#"+dhtmlx.math.toHex(pos,2)+"00FF";}
 ],
 
 addSeries:function(obj){var temp = this._settings;this._settings = dhtmlx.extend({},temp);this._parseSettings(obj,{});this._series.push(this._settings);this._settings = temp;},
 
 _switchSerie:function(id, tag){var tip;this._active_serie = tag.getAttribute("userdata");if (!this._series[this._active_serie])return;for (var i=0;i < this._series.length;i++){tip = this._series[i].tooltip;if (tip)tip.disable();}
 tip = this._series[this._active_serie].tooltip;if (tip)tip.enable();},
 
 _drawLegend:function(ctx,data,width){var i,legend,legendContainer,legendHeight,legendItems,legendWidth, style, x=0,y=0;legend = this._settings.legend;style = (this._settings.legend.layout!="x"?"width:"+legend.width+"px":"");if(this.legendObj)this.legendObj.innerHTML = "";legendContainer = dhtmlx.html.create("DIV",{"class":"dhx_chart_legend",
 "style":"left:"+x+"px;top:"+y+"px;"+style
 },"");if(legend.padding){legendContainer.style.padding = legend.padding+"px";}
 this.legendObj = legendContainer;this._obj.appendChild(legendContainer);legendItems = [];if(!legend.values)for(i = 0;i < data.length;i++){legendItems.push(this._drawLegendText(legendContainer,legend.template(data[i])));}
 else
 for(i = 0;i < legend.values.length;i++){legendItems.push(this._drawLegendText(legendContainer,legend.values[i].text));}
 legendWidth = legendContainer.offsetWidth;legendHeight = legendContainer.offsetHeight;if(legendWidth<this._obj.offsetWidth){if(legend.layout == "x"&&legend.align == "center"){x = (this._obj.offsetWidth-legendWidth)/2;}
 if(legend.align == "right"){x = this._obj.offsetWidth-legendWidth;}
 if(legend.margin&&legend.align != "center"){x += (legend.align == "left"?1:-1)*legend.margin;}
 }
 if(legendHeight<this._obj.offsetHeight){if(legend.valign == "middle"&&legend.align != "center"&&legend.layout != "x")y = (this._obj.offsetHeight-legendHeight)/2;else if(legend.valign == "bottom")y = this._obj.offsetHeight-legendHeight;if(legend.margin&&legend.valign != "middle"){y += (legend.valign == "top"?1:-1)*legend.margin;}
 }
 legendContainer.style.left = x+"px";legendContainer.style.top = y+"px";ctx.save();for(i = 0;i < legendItems.length;i++){var item = legendItems[i];var itemColor = (legend.values?legend.values[i].color:this._settings.color.call(this,data[i]));this._drawLegendMarker(ctx,item.offsetLeft+x,item.offsetTop+y,itemColor,item.offsetHeight);}
 ctx.restore();legendItems = null;},
 
 _drawLegendText:function(cont,value){var style = "";if(this._settings.legend.layout=="x")style = "float:left;";var text = dhtmlx.html.create("DIV",{"style":style+"padding-left:"+(10+this._settings.legend.marker.width)+"px",
 "class":"dhx_chart_legend_item"
 },value);cont.appendChild(text);return text;},
 
 _drawLegendMarker:function(ctx,x,y,color,height){var marker = this._settings.legend.marker;ctx.strokeStyle = ctx.fillStyle = color;ctx.beginPath();if(marker.type=="round"||!marker.radius){ctx.lineWidth = marker.height;ctx.lineCap = marker.type;x += ctx.lineWidth/2+5;y += height/2;ctx.moveTo(x,y);var x1 = x + marker.width-marker.height +1;ctx.lineTo(x1,y);}else{ctx.lineWidth = 1;var x0,y0;x += 5;y += height/2-marker.height/2;x0 = x+ marker.width/2;y0= y+marker.height/2;ctx.arc(x+marker.radius,y+marker.radius,marker.radius,Math.PI,3*Math.PI/2,false);ctx.lineTo(x+marker.width-marker.radius,y);ctx.arc(x+marker.width-marker.radius,y+marker.radius,marker.radius,-Math.PI/2,0,false);ctx.lineTo(x+marker.width,y+marker.height-marker.radius);ctx.arc(x+marker.width-marker.radius,y+marker.height-marker.radius,marker.radius,0,Math.PI/2,false);ctx.lineTo(x+marker.radius,y+marker.height);ctx.arc(x+marker.radius,y+marker.height-marker.radius,marker.radius,Math.PI/2,Math.PI,false);ctx.lineTo(x,y+marker.radius);}
 ctx.stroke();ctx.fill();},
 
 _getChartBounds:function(width,height){var chartX0, chartY0, chartX1, chartY1;chartX0 = this._settings.padding.left;chartY0 = this._settings.padding.top;chartX1 = width - this._settings.padding.right;chartY1 = height - this._settings.padding.bottom;if(this._settings.legend){var legend = this._settings.legend;var legendWidth = this._settings.legend.width;var legendHeight = this._settings.legend.height;if(legend.layout == "x"){if(legend.valign == "center"){if(legend.align == "right")chartX1 -= legendWidth;else if(legend.align == "left")chartX0 += legendWidth;}
 else if(legend.valign == "bottom"){chartY1 -= legendHeight;}
 else{chartY0 += legendHeight;}
 }
 
 else{if(legend.align == "right")chartX1 -= legendWidth;else if(legend.align == "left")chartX0 += legendWidth;}
 }
 return {start:{x:chartX0,y:chartY0},end:{x:chartX1,y:chartY1}};},
 
 _getStackedLimits:function(data){var i,j,maxValue,minValue,value;if(this._settings.yAxis&&(typeof this._settings.yAxis.end!="undefined")&&(typeof this._settings.yAxis.start!="undefined")&&this._settings.yAxis.step){maxValue = parseFloat(this._settings.yAxis.end);minValue = parseFloat(this._settings.yAxis.start);}
 else{for(i=0;i < data.length;i++){data[i].$sum = 0 ;data[i].$min = Infinity;for(j =0;j < this._series.length;j++){value = parseFloat(this._series[j].value(data[i])||0);if(isNaN(value)) continue;data[i].$sum += value;if(value < data[i].$min)data[i].$min = value;}
 }
 maxValue = -Infinity;minValue = Infinity;for(i=0;i < data.length;i++){if (data[i].$sum > maxValue)maxValue = data[i].$sum ;if (data[i].$min < minValue)minValue = data[i].$min ;}
 if(minValue>0)minValue =0;}
 return {max:maxValue,min:minValue};},
 
 _setBarGradient:function(ctx,x1,y1,x2,y2,type,color,axis){var gradient,offset,rgb,hsv,color0;if(type == "light"){if(axis == "x")gradient = ctx.createLinearGradient(x1,y1,x2,y1);else
 gradient = ctx.createLinearGradient(x1,y1,x1,y2);gradient.addColorStop(0,"#FFFFFF");gradient.addColorStop(0.9,color);gradient.addColorStop(1,color);offset = 2;}
 else if(type == "falling"||type == "rising"){if(axis == "x")gradient = ctx.createLinearGradient(x1,y1,x2,y1);else
 gradient = ctx.createLinearGradient(x1,y1,x1,y2);rgb = dhtmlx.math.toRgb(color);hsv = dhtmlx.math.rgbToHsv(rgb[0],rgb[1],rgb[2]);hsv[1] *= 1/2;color0 = "rgb("+dhtmlx.math.hsvToRgb(hsv[0],hsv[1],hsv[2])+")";if(type == "falling"){gradient.addColorStop(0,color0);gradient.addColorStop(0.7,color);gradient.addColorStop(1,color);}
 else if(type == "rising"){gradient.addColorStop(0,color);gradient.addColorStop(0.3,color);gradient.addColorStop(1,color0);}
 offset = 0;}
 else{ctx.globalAlpha = 0.37;offset = 0;if(axis == "x")gradient = ctx.createLinearGradient(x1,y2,x1,y1);else
 gradient = ctx.createLinearGradient(x1,y1,x2,y1);gradient.addColorStop(0,"#9d9d9d");gradient.addColorStop(0.3,"#e8e8e8");gradient.addColorStop(0.45,"#ffffff");gradient.addColorStop(0.55,"#ffffff");gradient.addColorStop(0.7,"#e8e8e8");gradient.addColorStop(1,"#9d9d9d");}
 return {gradient:gradient,offset:offset};},
 
 _getPositionByAngle:function(a,x,y,r){a *= (-1);x = x+Math.cos(a)*r;y = y-Math.sin(a)*r;return {x:x,y:y};}
};dhtmlx.compat("layout");function dhtmlXColorPickerInput(container){if (typeof(container)!="object")
 container=document.getElementById(container);var n=container;var cb=n.getAttribute("colorbox");var cc=n.getAttribute("customcolors");var cs=n.getAttribute("selectonclick");var cv=n.getAttribute("fullview");var sc=n.getAttribute("selectedcolor");var k=n;if (cb){var d=document.createElement("DIV");d.style.width=n.offsetWidth+"px";d.style.height=n.offsetHeight+"px";n.style.width=n.offsetWidth-n.offsetHeight-2;n.parentNode.insertBefore(d,n);d.style.position="relative";k=document.createElement("DIV");d.appendChild(k);d.appendChild(n);k.className="cs_colorBox";n.className+=" cs_colorInput";k.style.width=k.style.height=(n.offsetHeight-(document.all?0:2))+"px";n.style.left=n.offsetHeight+2+"px";}
 var z2=new dhtmlXColorPicker(null,cs,cc,true,cv);if (sc)z2.setColor(sc);z2.linkToObjects = [k,n,n];return z2;}
function dhtmlXColorPicker(container, isClickOnly, customColors, hide, fullview)
{if (document.all)try {document.execCommand("BackgroundImageCache", false, true);}catch (e){}
 this._cc=customColors;if (!container){container=document.createElement("DIV");container.style.position="absolute";document.body.appendChild (container);container._dhx_remove=true;}
 if (typeof(container)!="object")
 this.container = document.getElementById(container);else
 this.container = container;dhtmlxEventable(this);this.skinName = dhtmlx.skin || '';this.ready = false;this.hideOnInit = hide || false;this.linkToObjects = [];this.imgURL = dhtmlx.image_path||window.dhx_globalImgPath||"";this.hideSelfOnSelect = true;this.hex = "000000";this.h = 100;this.s = 0.9;this.v = 0.1;this.r = 0;this.g = 0;this.b = 0;this.old_hue = 0;this.old_sat = 0;this.fullview = fullview || false;this.customColorsCount=(!this.fullview?10:8);this.language = null;this.elements = new Array();this.customColors = new Array();this.restoreFrom = null;if (!this.fullview){this.colorSelectH = 119;this.colorSelectW = 209;}else {this.colorSelectH = 255;this.colorSelectW = 255;}
 

 this.isClickOnly = isClickOnly||false;if (window.cs_dechex == null){var hexDigit = new Array(0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f');window.cs_dechex = new Array();for (var i=0;i<256;i++){var retval = hexDigit[i>>4].toString()+hexDigit[i&15].toString();if (retval.length < 2)retval = '0'+retval;window.cs_dechex[i] = retval;}
 }
 defLeng = {langname: 'en-us',
 labelHue : "Hue",
 labelSat : "Sat",
 labelLum : "Lum",
 labelRed : "Red",
 labelGreen : "Green",
 labelBlue : "Blue",
 btnAddColor : "Add to Custom Colors",
 btnSelect : "Select",
 btnCancel : "Cancel"
 }
 
 if (window.dhtmlxColorPickerObjects)window.dhtmlxColorPickerObjects[window.dhtmlxColorPickerObjects.length] = this;else window.dhtmlxColorPickerObjects = [this];if (!window.dhtmlxColorPickerLangModules)window.dhtmlxColorPickerLangModules = {};window.dhtmlxColorPickerLangModules['en-us'] = defLeng;return this;}
dhtmlXColorPicker.prototype.generate = function()
{X = (document.compatMode!="BackCompat"?"X":"");if (!this.fullview){var html = "<div class='dhtmlxcolorpicker" + (this.skinName != '' ? '_' + this.skinName : '') + "' csid='cs_Content' style='display:none;'>";if ((document.all)&&((this.container.style.position=="absolute")))
 html +="<iframe src='"+(this.imgURL||"")+"blank.html' frameBorder='0' style='position:absolute;top:0px;left:0px;width:252px;height:"+(this._cc?300:244)+"px;z-index:-1;'></iframe>";html += "<table cellpadding='0' cellspacing='0'>";html += "<tr><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"left_top.gif);'></td><td style='height:2px;background:url("+(this.imgURL||"")+"top.gif);'></td><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"right_top.gif);'></td></tr>";html += "<tr><td style='width:2px;background:url("+(this.imgURL||"")+"left.gif);'></td><td style='width:"+(document.all?247:243)+"px;height:"+(this._cc?281:240)+"px;'>";html +="<table class='cs_ContentTable' csid='cs_ContentTable' cellpadding='0px' cellspacing='0px'>";html += "<tr>";html += "<td><div class='cs_SelectorDiv_Mini' csid='cs_SelectorDiv'><div class='cs_SelectorVer' csid='cs_SelectorVer' style='left:100px;top:0px;'></div><div class='cs_SelectorHor' csid='cs_SelectorHor' style='left:0px;top:100px;'></div></div></td>";html += "<td><div class='cs_LumSelect_Mini' csid='cs_LumSelect'><div csid='cs_LumSelectArrow'></div><div class='cs_LumSelectLine' csid='cs_LumSelectLine' style='left:0px;top:0px;'></div></div></td>";html += "</tr>";html += "<tr><td style='padding-top:10px;' colspan='2'>";html += "<table class='cs_ColorArea_Mini' cellpadding='0px' cellspacing='0px'>";html += "<tr><td rowspan='2' valign='top' style='text-align:left;'><div class='cs_EndColor_Mini' csid='cs_EndColor' ></div></td><td>"+this.language.labelHue+":</td><td><input tabindex='1' class='cs_Input_Mini"+X+"' csid='cs_InputHue' value='' /></td><td>"+this.language.labelRed+":</td><td><input tabindex='4' class='cs_Input_Mini"+X+"' csid='cs_InputRed' value='' /></td></tr>";html += "<tr><td>"+this.language.labelSat+":</td><td><input tabindex='2' class='cs_Input_Mini"+X+"' csid='cs_InputSat' value='' /></td><td>"+this.language.labelGreen+":</td><td><input tabindex='4' class='cs_Input_Mini"+X+"' csid='cs_InputGreen' value='' /></td></tr>";html += "<tr><td style='vertical-align:top;width:80px;text-align:left;'># <input csid='cs_Hex' class='cs_Hex_Mini"+X+"'></td><td>"+this.language.labelLum+":</td><td><input tabindex='2' class='cs_Input_Mini"+X+"' csid='cs_InputLum' value='' /></td><td>"+this.language.labelBlue+":</td><td><input tabindex='4' class='cs_Input_Mini"+X+"' csid='cs_InputBlue' value='' /></td></tr>";if (this._cc){html += "<tr><td colspan='6'><input tabindex='7' class='cs_CustomColorAdd_Mini' csid='cs_CustomColorAdd' type='button' value='"+this.language.btnAddColor+"'></td></tr>";html += "<tr><td colspan='6'><div class='cs_CustomColors_Mini' csid='cs_CustomColors'></div></td></tr>";}
 html += "</table>";html += "</td></tr>";html += "</table>";html += "<table class='cs_ButtonsPanel' cellpadding='0' cellspacing='0' style='width:100%;'><tr><td style='width:100%;'><input tabindex='9' class='cs_ButtonCancel' csid='cs_ButtonCancel' type='button' value='"+this.language.btnCancel+"' /><input tabindex='8' class='cs_ButtonOk' csid='cs_ButtonOk' type='button' value='"+this.language.btnSelect+"' /></td></tr></table>";html += "</td><td style='width:2px;background:url("+(this.imgURL||"")+"right.gif);'></td></tr>";html += "<tr><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"left_bottom.gif);'></td><td style='height:2px;background:url("+(this.imgURL||"")+"bottom.gif);'></td><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"right_bottom.gif);'></td></tr>";html += "</table>";html +="</div>";}else {var html = "<div class='dhtmlxcolorpicker" + (this.skinName != '' ? '_' + this.skinName : '') + "' csid='cs_Content' style='display:none;'>";if ((document.all)&&((this.container.style.position=="absolute")))
 html +="<iframe src='"+(this.imgURL||"")+"blank.html' style='position:absolute;top:0px;left:0px;width:320px;height:"+(this._cc?454:407)+"px;z-index:-1;'></iframe>";html += "<table cellpadding='0' cellspacing='0'>";html += "<tr><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"left_top.gif);'></td><td style='height:2px;background:url("+(this.imgURL||"")+"top.gif);'></td><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"right_top.gif);'></td></tr>";html += "<tr><td style='width:2px;background:url("+(this.imgURL||"")+"left.gif);'></td><td style='width:316px;height:"+(this._cc?446:392)+"px;background:#E6E5E5;'>";html +="<table class='cs_ContentTable' csid='cs_ContentTable' cellpadding='0px' cellspacing='0px'>";html += "<tr>";html += "<td><div class='cs_SelectorDiv' csid='cs_SelectorDiv'><div class='cs_SelectorVer' csid='cs_SelectorVer' style='left:100px;top:0px;'></div><div class='cs_SelectorHor' csid='cs_SelectorHor' style='left:0px;top:100px;'></div></div></td>";html += "<td><div class='cs_LumSelect' csid='cs_LumSelect'><div class='cs_LumSelectArrow' csid='cs_LumSelectArrow' style='left:16px;top:124px;'></div><div class='cs_LumSelectLine' csid='cs_LumSelectLine' style='left:0px;top:0px;'></div></div></td>";html += "</tr>";html += "<tr><td style='padding-top:10px;' colspan='2'>";html += "<table class='cs_ColorArea' cellpadding='0px' cellspacing='0px'>";html += "<tr><td rowspan='3'><div class='cs_EndColor' csid='cs_EndColor'></div></td><td valign='top' style='text-align:center;width:80px;'># <input csid='cs_Hex' class='cs_Hex'></td><td>"+this.language.labelHue+":</td><td><input tabindex='1' class='cs_Input' csid='cs_InputHue' value='' /></td><td>"+this.language.labelRed+":</td><td><input tabindex='4' class='cs_Input' csid='cs_InputRed' value='' /></td></tr>";html += "<tr><td></td><td>"+this.language.labelSat+":</td><td><input tabindex='2' class='cs_Input' csid='cs_InputSat' value='' /></td><td>"+this.language.labelGreen+":</td><td><input tabindex='4' class='cs_Input' csid='cs_InputGreen' value='' /></td></tr>";html += "<tr><td></td><td>"+this.language.labelLum+":</td><td><input tabindex='2' class='cs_Input' csid='cs_InputLum' value='' /></td><td>"+this.language.labelBlue+":</td><td><input tabindex='4' class='cs_Input' csid='cs_InputBlue' value='' /></td></tr>";if (this._cc){html += "<tr><td>";html += "<div class='cs_CustomColors' csid='cs_CustomColors'></div>";html += "</td><td></td><td colspan='4' valign='top'><input tabindex='7' class='cs_CustomColorAdd' csid='cs_CustomColorAdd' type='button' value='"+this.language.btnAddColor+"'></td></tr>";}
 html += "</table>";html += "</td></tr>";html += "</table>";html += "<table cellpadding='0' cellspacing='0' style='width:100%;'><tr><td style='height:49px;background:url("+(this.imgURL||"")+"buttons_panel.gif);'><input tabindex='9' class='cs_ButtonCancel' csid='cs_ButtonCancel' type='button' value='"+this.language.btnCancel+"' /><input tabindex='8' class='cs_ButtonOk' csid='cs_ButtonOk' type='button' value='"+this.language.btnSelect+"' /></td></tr></table>";html += "</td><td style='width:2px;background:url("+(this.imgURL||"")+"right.gif);'></td></tr>";html += "<tr><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"left_bottom.gif);'></td><td style='height:2px;background:url("+(this.imgURL||"")+"bottom.gif);'></td><td style='width:2px;height:2px;background:url("+(this.imgURL||"")+"right_bottom.gif);'></td></tr>";html += "</table>";html +="</div>";}
 if (!this.fullview)this.container.style.width="252px";else 
 this.container.style.width="320px";this.container.innerHTML = html;this._initCsIdElement();if (!this.fullview)this.elements['cs_SelectorDiv'].style.backgroundImage='url('+(this.imgURL||"")+'colormini.png)';else
 this.elements['cs_SelectorDiv'].style.backgroundImage='url('+(this.imgURL||"")+'color.png)';this.elements['cs_SelectorDiv'].z = this;this.elements['cs_LumSelect'].z = this;this.elements['cs_LumSelectArrow'].z = this;this.z = this;this._drawLum();this._colorizeLum(this.old_hue, this.old_sat);this._initEvents();if (this._cc)this._initCustomColors();this.ColorNum = 0;this.restoreFromHSV();this._drawValues();}
dhtmlXColorPicker.prototype._initCsIdElement = function(obj)
{if (obj == null)obj = this.container;var childs = obj.childNodes;var l = childs.length;for (var i=0;i<l;i++){if (childs[i].nodeType == 1){var attr = childs[i].getAttribute('csid');if (attr !== null){this.elements[attr] = childs[i];}
 if (childs[i].childNodes.length > 0){this._initCsIdElement(childs[i]);}
 }
 }
}
dhtmlXColorPicker.prototype._initEvents = function()
{this.elements['cs_SelectorDiv'].onmousedown = this._startMoveColor;this.elements['cs_SelectorDiv'].ondblclick = this.clickOk;this.elements['cs_LumSelect'].onmousedown = this._startMoveLum;this.elements['cs_LumSelect'].ondblclick = this.clickOk;this.elements['cs_LumSelectArrow'].onmousedown = this._startMoveLum;if (this._cc){this.elements['cs_CustomColorAdd'].z = this;this.elements['cs_CustomColorAdd'].onclick = this.addCustomColor;this.elements['cs_CustomColorAdd'].onmouseover = this.hoverButton;this.elements['cs_CustomColorAdd'].onmouseout = this.normalButton;}
 var inputs = new Array('cs_InputHue', 'cs_InputRed', 'cs_InputSat', 'cs_InputGreen', 'cs_InputLum', 'cs_InputBlue');for (var i=0;i<inputs.length;i++){this.elements[inputs[i]].z = this;this.elements[inputs[i]].onchange = i%2?this._changeValueRGB:this._changeValueHSV;}
 this.elements['cs_Hex'].z = this;this.elements['cs_Hex'].onchange = this._changeValueHEX;this.elements['cs_ButtonOk'].z = this;this.elements['cs_ButtonOk'].onclick = this.clickOk;this.elements['cs_ButtonOk'].onmouseover = this.hoverButton;this.elements['cs_ButtonOk'].onmouseout = this.normalButton;this.elements['cs_ButtonCancel'].z = this;this.elements['cs_ButtonCancel'].onclick = this.clickCancel;this.elements['cs_ButtonCancel'].onmouseover = this.hoverButton;this.elements['cs_ButtonCancel'].onmouseout = this.normalButton;}
dhtmlXColorPicker.prototype.resetHandlers = function(ev)
{}
dhtmlXColorPicker.prototype.clickOk = function(ev)
{var z = this.z;var t=z.getSelectedColor();z.callEvent ("onSelect", [t[0]]);if (z.hideSelfOnSelect)z.hide();}
dhtmlXColorPicker.prototype.clickCancel = function(ev)
{var z = this.z;z.callEvent("onCancel",[]);if (this.z.hideSelfOnSelect)this.z.hide();}
dhtmlXColorPicker.prototype._setCrossPos = function(ev)
{var z = this.z;var offset = z._getOffset(this.elements['cs_SelectorDiv']);var y = ev.clientY - offset[0];if (y < 0)y = 0;else if (y > this.colorSelectH)y = this.colorSelectH;var x = ev.clientX - offset[1];if (x < 0)x = 0;else if (x > this.colorSelectW)x = this.colorSelectW;z.elements['cs_SelectorVer'].style.left = x+'px';z.elements['cs_SelectorHor'].style.top = y+'px';var H = x==this.colorSelectW?0:360*x/this.colorSelectW;var S = 1-y/this.colorSelectH;return [H, S];}
dhtmlXColorPicker.prototype._getScrollers = function(){return ([(document.body.scrollLeft||document.documentElement.scrollLeft),(document.body.scrollTop||document.documentElement.scrollTop)]);}
dhtmlXColorPicker.prototype._setLumPos = function(ev)
{var z = this.z;var offset = z._getOffset(z.elements['cs_LumSelect']);var y = ev.clientY - offset[0] - 4;if (y < -3)y = -3;if (y > this.colorSelectH-4)y = this.colorSelectH-4;z.elements['cs_LumSelectArrow'].style.top = y+'px';z.elements['cs_LumSelectLine'].style.top = y+4+'px';var V = (y+3)/this.colorSelectH;return V;}
dhtmlXColorPicker.prototype._startMoveColor = function(ev)
{var z = this.z;if (ev == null)ev = event;z.elements['cs_SelectorDiv'].onmousedown = null;z.b_move = document.body.onmousemove;z.b_up = document.body.onmouseup;var self=z;document.body.onmousemove = function(e) {if (e ==null)e = event;self._mouseMoveColor(e);};document.body.onmouseup = function(e) {if (e ==null)e = event;self._stopMoveColor(e);self = null;};z.elements['cs_SelectorDiv'].onmousemove = z._mouseMoveColor;z.elements['cs_SelectorDiv'].onmouseup = z._stopMoveColor;var HS = z._setCrossPos(ev);z.h = HS[0];z.s = HS[1];var col = z._calculateColor();z._colorizeLum(col[0], col[1]);}
dhtmlXColorPicker.prototype._mouseMoveColor = function(ev)
{var z = this.z;if (ev == null)ev = event;var HS = z._setCrossPos(ev);if (z.isClickOnly)return;z.h = HS[0];z.s = HS[1];var col = z._calculateColor();z._colorizeLum(col[0], col[1]);}
dhtmlXColorPicker.prototype._stopMoveColor = function(ev)
{var z = this.z;if (ev == null)ev = event;z.elements['cs_SelectorDiv'].onmousedown = z._startMoveColor;z.elements['cs_SelectorDiv'].onmousemove = null;z.elements['cs_SelectorDiv'].onmouseup = null;document.body.onmousemove = z.b_move;document.body.onmouseup = z.b_up;var HS = z._setCrossPos(ev);z.h = HS[0];z.s = HS[1];var col = z._calculateColor();z._colorizeLum(col[0], col[1]);}
dhtmlXColorPicker.prototype._startMoveLum = function(ev)
{var z = this.z;if (ev == null)ev = event;z.elements['cs_LumSelect'].onmousedown = null;z.elements['cs_LumSelectArrow'].onmousedown = null;z.elements['cs_LumSelect'].onmousemove = z._mouseMoveLum;z.elements['cs_LumSelect'].onmouseup = z._stopMoveLum;z.b_move = document.body.onmousemove;z.b_up = document.body.onmouseup;z.b_selstart = document.body.onselectstart;var self=z;document.body.onmousemove = function(e) {if (e == null)e = event;self._mouseMoveLum(e);}
 document.body.onmouseup = function(e) {if (e == null)e = event;self._stopMoveLum(e);self = null;}
 document.body.onselectstart = function() {return false}
 z.v = z._setLumPos(ev);z._calculateColor();}
dhtmlXColorPicker.prototype._mouseMoveLum = function(ev)
{var z = this.z;if (ev == null)ev = event;z.v = z._setLumPos(ev);if (z.isClickOnly)return;z._calculateColor();}
dhtmlXColorPicker.prototype._stopMoveLum = function(ev)
{var z = this.z;if (ev == null)ev = event;z.elements['cs_LumSelect'].onmousedown = z._startMoveLum;z.elements['cs_LumSelectArrow'].onmousedown = z._startMoveLum;z.elements['cs_LumSelect'].onmousemove = null;z.elements['cs_LumSelect'].onmouseup = null;z.v = z._setLumPos(ev);z._calculateColor();document.body.onmousemove = z.b_move;document.body.onmouseup = z.b_up;document.body.onselectstart = z.b_selstart;}
dhtmlXColorPicker.prototype._getOffset = function(node)
{var top = this._getOffsetTop(node);var left = this._getOffsetLeft(node);var mod=this._getScrollers();return [top-mod[1], left-mod[0]];}
dhtmlXColorPicker.prototype._getOffsetTop = function(node)
{var offset = 0;if (node.offsetParent)offset += node.offsetTop+this._getOffsetTop(node.offsetParent);return offset;}
dhtmlXColorPicker.prototype._getOffsetLeft = function(node)
{var offset = 0;if (node.offsetParent)offset += node.offsetLeft+this._getOffsetLeft(node.offsetParent);return offset;}
dhtmlXColorPicker.prototype._calculateColor = function()
{if (this.restoreFrom == 'RGB'){var rgb = [this.r, this.g, this.b];}
 else {var rgb = this._hsv2rgb(this.h, this.s, 1-this.v);this.r = rgb[0];this.g = rgb[1];this.b = rgb[2];}
 
 this.hex = this._getColorHEX(rgb);this.elements['cs_EndColor'].style.backgroundColor = '#'+this.hex;this._drawValues();this.restoreFrom = null;return [this.h, this.s, 1-this.v];}
dhtmlXColorPicker.prototype._drawValues = function()
{this.elements['cs_Hex'].value = this.hex;this.elements['cs_InputHue'].value = Math.floor(this.h);this.elements['cs_InputSat'].value = Math.floor(this.s*100);this.elements['cs_InputLum'].value = Math.floor((1-this.v)*100);this.elements['cs_InputRed'].value = Math.floor(this.r);this.elements['cs_InputGreen'].value = Math.floor(this.g);this.elements['cs_InputBlue'].value = Math.floor(this.b);}
dhtmlXColorPicker.prototype.saveColor = function(rgb, num)
{var date = new Date();var datevalue = date.valueOf()+2678400000;date = new Date(datevalue);var str = 'color_'+num+'='+rgb+';expires='+date.toGMTString();document.cookie = str;}
dhtmlXColorPicker.prototype.restoreColor = function(num) {var rgb = false;var name = 'color_'+num;if (document.cookie.length > 0){var pos = document.cookie.indexOf(name+'=');if (pos != -1){var pos2 = document.cookie.indexOf(';', pos);if (pos2 == -1)pos2 = document.cookie.length;var pos3 = document.cookie.indexOf('=', pos)+1;var rgb = document.cookie.substr(pos3, pos2-pos3);}
 }
 return rgb;}
dhtmlXColorPicker.prototype._hsv2rgb = function(h, s, v)
{Hi = Math.floor((h/60))%6;f = h/60-Hi;p = v*(1-s);q = v*(1-f*s);t = v*(1-(1-f)*s);var r = 0;var g = 0;var b = 0;switch(Hi) {case 0:
 r = v;g = t;b = p;break;case 1:
 r = q;g = v;b = p;break;case 2:
 r = p;g = v;b = t;break;case 3:
 r = p;g = q;b = v;break;case 4:
 r = t;g = p;b = v;break;case 5:
 r = v;g = p;b = q;break;}
 r = Math.floor(r*255);g = Math.floor(g*255);b = Math.floor(b*255);return [r, g, b];}
dhtmlXColorPicker.prototype._rgb2hsv = function(r, g, b)
{R = r/255;G = g/255;B = b/255;var MAX = Math.max(R, G, B);var MIN = Math.min(R, G, B);var V = MAX;var S = MAX==0?0:(1-MIN/MAX);var H = 0;if (MAX == MIN){H = 0;}else if (MAX == R && G>=B){H = 60*(G-B)/(MAX-MIN)+0;}else if (MAX == R && G < B){H = 60*(G-B)/(MAX-MIN)+360;}else if (MAX == G){H = 60*(B-R)/(MAX-MIN)+120;}else if (MAX == B){H = 60*(R-G)/(MAX-MIN)+240;}
 return [H, S, V];}
dhtmlXColorPicker.prototype._drawLum = function()
{var color = this.colorSelectH;var lumElemCount = (!this.fullview?30:64);var colorInc = (!this.fullview?8:4);for (var i=0;i<lumElemCount;i++){var d = document.createElement('div');var c = this._dec2hex(color);d.style.backgroundColor = '#'+c+c+c;d.className = 'cs_LumElement';color-=colorInc;this.elements['cs_LumSelect'].appendChild(d);}
}
dhtmlXColorPicker.prototype._colorizeLum = function(hue, sat)
{this.old_hue = hue;this.old_sat = sat;var lum = 255;var colorInc = (!this.fullview?8:4);var l = this.elements['cs_LumSelect'].childNodes.length;for (var i=2;i<l;i++){var v = (lum>255)?1:(lum/255);var rgb = this._hsv2rgb(hue, sat, v);var rgb = '#'+this._getColorHEX(rgb);this.elements['cs_LumSelect'].childNodes[i].style.backgroundColor = rgb;lum-=colorInc;}
 this.callEvent("onChange", [this.getSelectedColor()])
}
dhtmlXColorPicker.prototype._dec2hex = function(dec)
{return window.cs_dechex[dec]||'00';}
dhtmlXColorPicker.prototype._hex2dec = function(hex)
{return parseInt(hex, 16);}
dhtmlXColorPicker.prototype._initCustomColors = function()
{var colors = this.elements['cs_CustomColors'];for (var i=0;i<this.customColorsCount;i++){var d = document.createElement('div');d.className = (this.fullview?'cs_CustomColor':'cs_CustomColor_Mini');d.color_num = i;if (document.all){if (navigator.appName=='Opera'){if (!this.fullview){d.style.width = '18px';d.style.height = '18px';}else {d.style.width = '14px';d.style.height = '14px';}
 }
 else
 if (!this.fullview){if (document.compatMode != "BackCompat")d.style.width = '18px';else 
 d.style.width = '20px';d.style.height = '20px';}else {d.style.width = '16px';d.style.height = '16px';}
 }
 d.z = this;d.onclick=this._selectCustomColor;d.ondblclick=this.clickOk;var color = this.restoreColor(i)||'0,0,0';d.color = color;var rgb = color.split(',');d.style.backgroundColor = '#'+this._getColorHEX(rgb);this.customColors.push(d);colors.appendChild(d);}
}
dhtmlXColorPicker.prototype._reinitCustomColors = function()
{var colors = this.elements['cs_CustomColors'];for (var i=0;i<this.customColorsCount;i++){var d = this.customColors[i];var color = this.restoreColor(i)||'0,0,0';d.color = color;var rgb = color.split(',');d.style.backgroundColor = '#'+this._getColorHEX(rgb);this.customColors[i] = d;}
}
dhtmlXColorPicker.prototype._getColorHEX=function(rgb){var r = this._dec2hex(rgb[0]);var g = this._dec2hex(rgb[1]);var b = this._dec2hex(rgb[2]);return (r+g+b);}
dhtmlXColorPicker.prototype._selectCustomColor = function(ev)
{if (ev == null)ev = event;var z = this.z;if (!this.selected){for (var i = 0;i< z.customColors.length;i++)z.customColors[i].style.border = '1px solid gray';this.style.border = '1px dashed black';this.selected = true;if (z.selectedColor != null){z.customColors[z.selectedColor].style.border = '1px solid gray';z.customColors[z.selectedColor].selected = false;}
 }
 z.selectedColor = this.color_num;z.ColorNum = this.color_num;var color = this.color.split(',');z.r = color[0];z.g = color[1];z.b = color[2];z.restoreFromRGB();}
dhtmlXColorPicker.prototype.addCustomColor = function()
{var z = this.z;if (z.selectedColor != null){var d = z.customColors[z.selectedColor];var n = z.selectedColor;d.style.border = '1px solid gray';z.selectedColor = null;}else {var d = z.customColors[z.ColorNum];var n = z.ColorNum;d.style.border = '1px solid gray';}
 var rgb = z.r+','+z.g+','+z.b;z.saveColor(rgb, n);d.color = rgb;z.ColorNum = z.ColorNum==9?0:z.ColorNum+1;z.customColors[z.ColorNum].style.border = '1px dashed red';d.style.backgroundColor = z.elements['cs_EndColor'].style.backgroundColor;}
dhtmlXColorPicker.prototype.restoreFromRGB = function()
{this.restoreFrom = 'RGB';var HSV = this._rgb2hsv(this.r, this.g, this.b);this.h = HSV[0];this.s = HSV[1];this.v = 1-HSV[2];if (this.ready)this.redraw();}
dhtmlXColorPicker.prototype.restoreFromHSV = function()
{this.restoreFrom = 'HSV';var RGB = this._hsv2rgb(this.h, this.s, this.v);this.r = RGB[0];this.g = RGB[1];this.b = RGB[2];this.redraw();}
dhtmlXColorPicker.prototype.restoreFromHEX = function()
{this.r = this._hex2dec(this.hex.substr(0,2));this.g = this._hex2dec(this.hex.substr(2,2));this.b = this._hex2dec(this.hex.substr(4,2));this.restoreFromRGB();}
dhtmlXColorPicker.prototype.redraw = function()
{var x = this.colorSelectW*this.h/360;var y = (1-this.s)*this.colorSelectH;var top = (this.v)*this.colorSelectH;this.elements['cs_SelectorHor'].style.top = y+"px";this.elements['cs_SelectorVer'].style.left = x+"px";this.elements['cs_LumSelectArrow'].style.top = top-3+"px";this.elements['cs_LumSelectLine'].style.top = top+1+"px";var col = this._calculateColor();this._colorizeLum(col[0], col[1]);}
dhtmlXColorPicker.prototype._changeValueHSV = function()
{var z = this.z;var H = parseInt(z.elements['cs_InputHue'].value)||0;var S = parseInt(z.elements['cs_InputSat'].value)||0;var V = parseInt(z.elements['cs_InputLum'].value)||0;if (H < 0 || H > 359)H = 0;if (S < 0 || S > 100)S = 0;if (V < 0 || V > 100)V = 0;z.elements['cs_InputHue'].value = H;z.elements['cs_InputSat'].value = S;z.elements['cs_InputLum'].value = V;z.h = H;z.s = S/100;z.v = 1-V/100;z.restoreFromHSV();}
dhtmlXColorPicker.prototype._changeValueRGB = function()
{var z = this.z;var R = parseInt(z.elements['cs_InputRed'].value)||0;var G = parseInt(z.elements['cs_InputGreen'].value)||0;var B = parseInt(z.elements['cs_InputBlue'].value)||0;if (R < 0 || R > 255)R = 0;if (G < 0 || G > 255)G = 0;if (B < 0 || B > 255)B = 0;z.elements['cs_InputRed'].value = R;z.elements['cs_InputGreen'].value = G;z.elements['cs_InputBlue'].value = B;z.r = R;z.g = G;z.b = B;z.restoreFromRGB();}
dhtmlXColorPicker.prototype._changeValueHEX = function()
{var z = this.z;var hex = (z.elements['cs_Hex'].value)||000000;hex = hex.replace(/[^a-fA-F0-9]/gi,"0");if (hex.length>6)hex = hex.substr(0,6)
 else while (hex.length<6)hex += '0';z.elements['cs_Hex'].value = hex;z.hex = hex;z.restoreFromHEX();}
dhtmlXColorPicker.prototype.setCustomColors = function(colors)
{colors = colors.split(",");for (var i=0;i<colors.length;i++){var rgb = colors[i];if (rgb.substr(0, 1)== '#') {rgb = rgb.substr(1);}
 var R = this._hex2dec(rgb.substr(0, 2));var G = this._hex2dec(rgb.substr(2, 2));var B = this._hex2dec(rgb.substr(4, 2));rgb = R+','+G+','+B;this.saveColor(rgb, i);}
}
dhtmlXColorPicker.prototype.setColor = function(rgb)
{if (typeof(rgb)!= 'string') {var R = rgb[0];var G = rgb[1];var B = rgb[2];}else if (rgb.indexOf('rgb')!=-1) {var rgbArr = rgb.substr(rgb.indexOf("(")+1,rgb.lastIndexOf(")")-rgb.indexOf("(")-1).split(",");var R = rgbArr[0];var G = rgbArr[1];var B = rgbArr[2];}else {if (rgb.substr(0, 1)== '#') {rgb = rgb.substr(1);}
 var R = this._hex2dec(rgb.substr(0, 2));var G = this._hex2dec(rgb.substr(2, 2));var B = this._hex2dec(rgb.substr(4, 2));}
 R = parseInt(R)||0;G = parseInt(G)||0;B = parseInt(B)||0;if (R < 0 || R > 255)R = 0;if (G < 0 || G > 255)G = 0;if (B < 0 || B > 255)B = 0;this.r = R;this.g = G;this.b = B;this.restoreFromRGB();}
dhtmlXColorPicker.prototype.close = function()
{this.elements['cs_SelectorDiv'].z = null;this.elements['cs_LumSelect'].z = null;this.elements['cs_LumSelectArrow'].z = null;this.elements['cs_ButtonOk'].z = null;this.elements['cs_ButtonCancel'].z = null;if (this.cc)this.elements['cs_CustomColorAdd'].z = null;this.container.innerHTML="";if (this.container._dhx_remove)this.container.parentNode.removeChild(this.container);}
dhtmlXColorPicker.prototype.show = function()
{this.callEvent("onShow",[]);if (this.container.innerHTML=="")return;this.elements['cs_Content'].style.display = '';this.elements['cs_InputHue'].focus()
}
dhtmlXColorPicker.prototype.setPosition = function(x,y)
{this.container.style.position='absolute';this.container.style.top=(y>0?y:10)+"px";this.container.style.left=x+"px";}
dhtmlXColorPicker.prototype.hide = function()
{this.resetHandlers();if (this.elements['cs_Content'])this.elements['cs_Content'].style.display = 'none';}
dhtmlXColorPicker.prototype.setOnSelectHandler = function(func){this.attachEvent ("onSelect", func);}
dhtmlXColorPicker.prototype.setOnCancelHandler = function(func){this.attachEvent ("onCancel", func);}
dhtmlXColorPicker.prototype.getSelectedColor = function(){var rgb_dec = new Array(this.r, this.g, this.b);var rgb_hex = this._dec2hex(this.r)+this._dec2hex(this.g)+this._dec2hex(this.b);var hsl = new Array(this.h, this.s, this.v);return ["#"+rgb_hex,rgb_dec,hsl];}
dhtmlXColorPicker.prototype.linkTo = function(obj1,obj2,obj3){if (typeof(obj1)!="object")
 obj1=document.getElementById(obj1);if (typeof(obj2)!="object")
 obj2=document.getElementById(obj2);if (typeof(obj3)!="object")
 obj3=document.getElementById(obj3);this.linkToObjects = arguments;var self=this;obj2.onclick=function(){var z=self._getOffset(obj1);var s=self._getScrollers();var x=z[1]+s[0];var y=z[0]+s[1];self.setPosition(x+obj1.offsetWidth,y);self.isVisible() ? self.hide() : self.show();};this.setOnSelectHandler(function(color){obj1.style.backgroundColor=color;if (obj3)obj3.value=color;});this.close=this.hide;this.hide();}
dhtmlXColorPicker.prototype.hideOnSelect = function(value) {this.hideSelfOnSelect = value;}
dhtmlXColorPicker.prototype.setImagePath = function(path){this.imgURL = path;}
dhtmlXColorPicker.prototype.init = function(){if (!this.language)this.loadUserLanguage ("en-us");this.generate();this.ready = true;if (this._cc)this._reinitCustomColors();if (this.linkToObjects.length>0)this.linkTo(this.linkToObjects[0],this.linkToObjects[1],this.linkToObjects[2]);if (!this.hideOnInit)this.show();}
dhtmlXColorPicker.prototype.loadUserLanguage = function(lang) {if (!window.dhtmlxColorPickerLangModules [lang])return;this.language = window.dhtmlxColorPickerLangModules [lang];if (this.ready){this.generate();this.show();}
}
dhtmlXColorPicker.prototype.setSkin = function (skin) {this.skinName = skin;if (this.elements['cs_Content'])this.elements['cs_Content'].className = 'dhtmlxcolorpicker' + (skin ? '_' + skin : skin);}
 
dhtmlXColorPicker.prototype.isVisible = function () {return !(this.elements['cs_Content'].style.display == 'none');};dhtmlXColorPicker.prototype.hoverButton = function () {this.className += '_Hover';};dhtmlXColorPicker.prototype.normalButton = function () {this.className = this.className.substr(0, this.className.length-6)
};(function(){dhtmlx.extend_api("dhtmlXColorPicker",{_init:function(obj){return [obj.parent, obj.click, obj.colors, obj.hide, obj.full ];},
 show:"showA",
 link:"linkTo",
 image_path:"setImagePath",
 color:"setColor"
 },{showA:function(){this.init();this.show();}
 });})();function dhtmlXComboFromSelect(parent,size){if (typeof(parent)=="string")
 parent=document.getElementById(parent);size=size||parent.getAttribute("width")||(window.getComputedStyle?window.getComputedStyle(parent,null)["width"]:(parent.currentStyle?parent.currentStyle["width"]:0));if ((!size)||(size=="auto"))
 size=parent.offsetWidth||100;var z=document.createElement("SPAN");parent.parentNode.insertBefore(z,parent);parent.style.display='none';var s_type = parent.getAttribute('opt_type');var w= new dhtmlXCombo(z,parent.name,size,s_type,parent.tabIndex);var x=new Array();var sel=-1;for (var i=0;i<parent.options.length;i++){if (parent.options[i].selected)sel=i;var label=parent.options[i].innerHTML;var val=parent.options[i].getAttribute("value");if ((typeof(val)=="undefined")||(val===null)) val=label;x[i]={value:val,text:label,img_src:parent.options[i].getAttribute("img_src")};}
 if(x.length)w.addOption(x);parent.parentNode.removeChild(parent);if (sel>=0)w.selectOption(sel,null,true);if (parent.onchange)w.attachEvent("onChange",parent.onchange);if(parent.style.direction=="rtl" && w.setRTL)w.setRTL(true);return w;}
var dhtmlXCombo_optionTypes = [];function dhtmlXCombo(parent,name,width,optionType,tabIndex){if (typeof(parent)=="string")
 parent=document.getElementById(parent);this.dhx_Event();this.optionType = (optionType != window.undefined && dhtmlXCombo_optionTypes[optionType]) ? optionType : 'default';this._optionObject = dhtmlXCombo_optionTypes[this.optionType];this._disabled = false;this.readonlyDelay = 750;this.filterEntities = ["[","]","{","}","(",")","+","*","\\","?",".","$","^"];if (!window.dhx_glbSelectAr){window.dhx_glbSelectAr=new Array();window.dhx_openedSelect=null;window.dhx_SelectId=1;dhtmlxEvent(document.body,"click",this.closeAll);dhtmlxEvent(document.body,"keydown",function(e){try {if ((e||event).keyCode==9) window.dhx_glbSelectAr[0].closeAll();}catch(e) {}return true;});}
 
 if (parent.tagName=="SELECT")return dhtmlXComboFromSelect(parent);else
 this._createSelf(parent,name,width,tabIndex);dhx_glbSelectAr.push(this);}
 dhtmlXCombo.prototype.setSize = function(new_size){this.DOMlist.style.width=new_size+"px";if (this.DOMlistF)this.DOMlistF.style.width=new_size+"px";this.DOMelem.style.width=new_size+"px";this.DOMelem_input.style.width = Math.max(0,(new_size-19))+'px';}

 dhtmlXCombo.prototype.enableFilteringMode = function(mode,url,cache,autosubload){if(mode=="between"){this._filter= true;this._anyPosition = true;this._autoDisabled = true;}
 else
 this._filter=convertStringToBoolean(mode);if (url){this._xml=url;this._autoxml=convertStringToBoolean(autosubload);}
 if (convertStringToBoolean(cache)) this._xmlCache=[];}
 
 dhtmlXCombo.prototype.setFilteringParam=function(name,value){if (!this._prs)this._prs=[];this._prs.push([name,value]);}
 dhtmlXCombo.prototype.disable = function(mode){var z=convertStringToBoolean(mode);if (this._disabled==z)return;this.DOMelem_input.disabled=z;this._disabled=z;}
 dhtmlXCombo.prototype.readonly = function(mode,autosearch){this.DOMelem_input.readOnly=mode ? true : false;if(autosearch===false || mode===false){this.DOMelem.onkeyup=function(ev){}
 }else {var that = this;this.DOMelem.onkeyup=function(ev){ev=ev||window.event;if(that._searchTimeout)window.clearTimeout(that._searchTimeout);if (ev.keyCode!=9)ev.cancelBubble=true;if((ev.keyCode >= 48 && ev.keyCode <= 57)||(ev.keyCode >= 65 && ev.keyCode <= 90)){if (!that._searchText)that._searchText="";that._searchText += String.fromCharCode(ev.keyCode);for(var i=0;i<that.optionsArr.length;i++){var text = that.optionsArr[i].text;if(text.toString().toUpperCase().indexOf(that._searchText) == 0){that.selectOption(i);break;}
 }
 that._searchTimeout=window.setTimeout(function() {that._searchText="";}, that.readonlyDelay);ev.cancelBubble=true;}
 }
 }
 }
 

 dhtmlXCombo.prototype.getOption = function(value)
 {for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].value==value)return this.optionsArr[i];return null;}
 dhtmlXCombo.prototype.getOptionByLabel = function(value)
 {for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].text==value || this.optionsArr[i]._ctext==value)return this.optionsArr[i];return null;}
 dhtmlXCombo.prototype.getOptionByIndex = function(ind){return this.optionsArr[ind];}
 dhtmlXCombo.prototype.clearAll = function(all)
 {if (all)this.setComboText("");this.optionsArr=new Array();this.redrawOptions();if (all){if(this._selOption)this._selOption.RedrawHeader(this,true);this._confirmSelection();}
 }
 dhtmlXCombo.prototype.deleteOption = function(value)
 {var ind=this.getIndexByValue(value);if(ind<0)return;if (this.optionsArr[ind]==this._selOption)this._selOption=null;this.optionsArr.splice(ind, 1);this.redrawOptions();}
 dhtmlXCombo.prototype.render=function(mode){this._skiprender=(!convertStringToBoolean(mode));this.redrawOptions();}
 dhtmlXCombo.prototype.updateOption = function(oldvalue, avalue, atext, acss)
 {var dOpt=this.getOption(oldvalue);if (typeof(avalue)!="object") avalue={text:atext,value:avalue,css:acss};dOpt.setValue(avalue);this.redrawOptions();}
 dhtmlXCombo.prototype.addOption = function(options)
 {if (!arguments[0].length || typeof(arguments[0])!="object")
 args = [arguments];else
 args = options;this.render(false);for (var i=0;i<args.length;i++){var attr = args[i];if (attr.length){attr.value = attr[0]||"";attr.text = attr[1]||"";attr.css = attr[2]||"";}
 this._addOption(attr);}
 this.render(true);}
 dhtmlXCombo.prototype._addOption = function(attr)
 {dOpt = new this._optionObject();this.optionsArr.push(dOpt);dOpt.setValue.apply(dOpt,[attr]);this.redrawOptions();}
 dhtmlXCombo.prototype.getIndexByValue = function(val){for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].value == val)return i;return -1;}
 dhtmlXCombo.prototype.getSelectedValue = function(){return (this._selOption?this._selOption.value:null);}
 dhtmlXCombo.prototype.getComboText = function(){return this.DOMelem_input.value;}
 dhtmlXCombo.prototype.setComboText = function(text){this.DOMelem_input.value=text;}
 

 dhtmlXCombo.prototype.setComboValue = function(text){this.setComboText(text);for(var i=0;i<this.optionsArr.length;i++)if (this.optionsArr[i].data()[0]==text)
 return this.selectOption(i,null,true);this.DOMelem_hidden_input.value=text;}
 dhtmlXCombo.prototype.getActualValue = function(){return this.DOMelem_hidden_input.value;}
 dhtmlXCombo.prototype.getSelectedText = function(){return (this._selOption?this._selOption.text:"");}
 dhtmlXCombo.prototype.getSelectedIndex = function(){for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i] == this._selOption)return i;return -1;}
 dhtmlXCombo.prototype.setName = function(name){this.DOMelem_hidden_input.name = name;this.DOMelem_hidden_input2 = name.replace(/(\]?)$/, "_new_value$1");this.name = name;}
 dhtmlXCombo.prototype.show = function(mode){if (convertStringToBoolean(mode))
 this.DOMelem.style.display = "";else
 this.DOMelem.style.display = "none";}
 dhtmlXCombo.prototype.destructor = function()
 {this.DOMParent.removeChild(this.DOMelem);this.DOMlist.parentNode.removeChild(this.DOMlist);if(this.DOMlistF)this.DOMlistF.parentNode.removeChild(this.DOMlistF);var s=dhx_glbSelectAr;this.DOMParent=this.DOMlist=this.DOMlistF=this.DOMelem=0;this.DOMlist.combo=this.DOMelem.combo=0;for(var i=0;i<s.length;i++){if(s[i] == this){s[i] = null;s.splice(i,1);return;}
 }
 }
 dhtmlXCombo.prototype._createSelf = function(selParent, name, width, tab)
 {if (width.toString().indexOf("%")!=-1){var self = this;var resWidht=parseInt(width)/100;window.setInterval(function(){if (!selParent.parentNode)return;var ts=selParent.parentNode.offsetWidth*resWidht-2;if (ts<0)return;if (ts==self._lastTs)return;self.setSize(self._lastTs=ts);},500);var width=parseInt(selParent.offsetWidth);}
 var width=parseInt(width||100);this.ListPosition = "Bottom";this.DOMParent = selParent;this._inID = null;this.name = name;this._selOption = null;this.optionsArr = Array();var opt = new this._optionObject();opt.DrawHeader(this,name, width,tab);this.DOMlist = document.createElement("DIV");this.DOMlist.className = 'dhx_combo_list '+(dhtmlx.skin?dhtmlx.skin+"_list":"");this.DOMlist.style.width=width-(_isIE?0:0)+"px";if (_isOpera || _isKHTML )this.DOMlist.style.overflow="auto";this.DOMlist.style.display = "none";document.body.insertBefore(this.DOMlist,document.body.firstChild);if (_isIE){this.DOMlistF = document.createElement("IFRAME");this.DOMlistF.style.border="0px";this.DOMlistF.className = 'dhx_combo_list';this.DOMlistF.style.width=width-(_isIE?0:0)+"px";this.DOMlistF.style.display = "none";this.DOMlistF.src="javascript:false;";document.body.insertBefore(this.DOMlistF,document.body.firstChild);}
 this.DOMlist.combo=this.DOMelem.combo=this;this.DOMelem_input.onkeydown = this._onKey;this.DOMelem_input.onkeypress = this._onKeyF;this.DOMelem_input.onblur = this._onBlur;this.DOMelem.onclick = this._toggleSelect;this.DOMlist.onclick = this._selectOption;this.DOMlist.onmousedown = function(){this._skipBlur=true;}
 
 this.DOMlist.onkeydown = function(e){(e||event).cancelBubble=true;this.combo.DOMelem_input.onkeydown(e)
 }
 this.DOMlist.onmouseover = this._listOver;}
 dhtmlXCombo.prototype._listOver = function(e)
 {e = e||event;e.cancelBubble = true;var node = (_isIE?event.srcElement:e.target);var that = this.combo;if ( node.parentNode == that.DOMlist ){if(that._selOption)that._selOption.deselect();if(that._tempSel)that._tempSel.deselect();var i=0;for (i;i<that.DOMlist.childNodes.length;i++){if (that.DOMlist.childNodes[i]==node)break;}
 var z=that.optionsArr[i];that._tempSel=z;that._tempSel.select();if ((that._autoxml)&&((i+1)==that._lastLength)){that._fetchOptions(i+1,that._lasttext||"");}
 }
 }
 dhtmlXCombo.prototype._positList = function()
 {var pos=this.getPosition(this.DOMelem);if(this.ListPosition == 'Bottom'){this.DOMlist.style.top = pos[1]+this.DOMelem.offsetHeight-1+"px";this.DOMlist.style.left = pos[0]+"px";}
 else if(this.ListPosition == 'Top'){this.DOMlist.style.top = pos[1] - this.DOMlist.offsetHeight+"px";this.DOMlist.style.left = pos[0]+"px";}
 else{this.DOMlist.style.top = pos[1]+"px";this.DOMlist.style.left = pos[0]+this.DOMelem.offsetWidth+"px";}
 }
 
 dhtmlXCombo.prototype.getPosition = function(oNode,pNode){if (_isIE && _isIE<8){if(!pNode)pNode = document.body;var oCurrentNode=oNode;var iLeft=0;var iTop=0;while ((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft+oCurrentNode.clientLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop+oCurrentNode.clientTop;oCurrentNode=oCurrentNode.offsetParent;}
 if (document.documentElement.scrollTop){iTop+=document.documentElement.scrollTop;}
 if (document.documentElement.scrollLeft){iLeft+=document.documentElement.scrollLeft;}
 return new Array(iLeft,iTop);}
 var pos = getOffset(oNode);return [pos.left, pos.top];}
 dhtmlXCombo.prototype._correctSelection = function(){if (this.getComboText()!="")
 for (var i=0;i<this.optionsArr.length;i++)if (!this.optionsArr[i].isHidden()){return this.selectOption(i,true,false);}
 this.unSelectOption();}
 dhtmlXCombo.prototype.selectNext = function(step){var z=this.getSelectedIndex()+step;while (this.optionsArr[z]){if (!this.optionsArr[z].isHidden())
 return this.selectOption(z,false,false);z+=step;}
 }
 dhtmlXCombo.prototype._onKeyF = function(e){var that=this.parentNode.combo;var ev=e||event;ev.cancelBubble=true;if (ev.keyCode=="13" || ev.keyCode=="9" ){that._confirmSelection();that.closeAll();}else
 if (ev.keyCode=="27" ){that._resetSelection();that.closeAll();}else that._activeMode=true;if (ev.keyCode=="13" || ev.keyCode=="27" ){that.callEvent("onKeyPressed",[ev.keyCode])
 return false;}
 return true;}
 dhtmlXCombo.prototype._onKey = function(e){var that=this.parentNode.combo;(e||event).cancelBubble=true;var ev=(e||event).keyCode;if (ev>15 && ev<19)return true;if (ev==27)return true;if ((that.DOMlist.style.display!="block")&&(ev!="13")&&(ev!="9")&&((!that._filter)||(that._filterAny)))
 that.DOMelem.onclick(e||event);if ((ev!="13")&&(ev!="9")){window.setTimeout(function(){that._onKeyB(ev);},1);if (ev=="40" || ev=="38")return false;}
 else if (ev==9){that._confirmSelection();that.closeAll();(e||event).cancelBubble=false;}
 }
 dhtmlXCombo.prototype._onKeyB = function(ev)
 {if (ev=="40"){var z=this.selectNext(1);}else if (ev=="38"){this.selectNext(-1);}else{this.callEvent("onKeyPressed",[ev])
 if (this._filter)return this.filterSelf((ev==8)||(ev==46));for(var i=0;i<this.optionsArr.length;i++)if (this.optionsArr[i].data()[1]==this.DOMelem_input.value){this.selectOption(i,false,false);return false;}
 this.unSelectOption();}
 return true;}
 dhtmlXCombo.prototype._onBlur = function()
 {var self = this.parentNode._self;window.setTimeout(function(){if (self.DOMlist._skipBlur)return !(self.DOMlist._skipBlur=false);self._skipFocus = true;self._confirmSelection();self.callEvent("onBlur",[]);},100)
 
 }
 dhtmlXCombo.prototype.redrawOptions = function(){if (this._skiprender)return;for(var i=this.DOMlist.childNodes.length-1;i>=0;i--)this.DOMlist.removeChild(this.DOMlist.childNodes[i]);for(var i=0;i<this.optionsArr.length;i++)this.DOMlist.appendChild(this.optionsArr[i].render());}
 dhtmlXCombo.prototype.loadXML = function(url,afterCall){this._load=true;this.callEvent("onXLS",[]);if (this._prs)for (var i=0;i<this._prs.length;i++)url+=[getUrlSymbol(url),escape(this._prs[i][0]),"=",escape(this._prs[i][1])].join("");if ((this._xmlCache)&&(this._xmlCache[url])){this._fillFromXML(this,null,null,null,this._xmlCache[url]);if (afterCall)afterCall();}
 else{var xml=(new dtmlXMLLoaderObject(this._fillFromXML,this,true,true));if (afterCall)xml.waitCall=afterCall;xml._cPath=url;xml.loadXML(url);}
 }
 dhtmlXCombo.prototype.loadXMLString = function(astring){var xml=(new dtmlXMLLoaderObject(this._fillFromXML,this,true,true));xml.loadXMLString(astring);}
 dhtmlXCombo.prototype._fillFromXML = function(obj,b,c,d,xml){if (obj._xmlCache)obj._xmlCache[xml._cPath]=xml;var toptag=xml.getXMLTopNode("complete");if (toptag.tagName!="complete"){obj._load=false;return;}
 var top=xml.doXPath("//complete");var options=xml.doXPath("//option");var add = false;obj.render(false);if ((!top[0])||(!top[0].getAttribute("add"))){obj.clearAll();obj._lastLength=options.length;if (obj._xml){if ((!options)|| (!options.length)) 
 obj.closeAll();else {if (obj._activeMode){obj._positList();obj.DOMlist.style.display="block";if (_isIE)obj._IEFix(true);}
 }}
 }else {obj._lastLength+=options.length||Infinity;add = true;}
 for (var i=0;i<options.length;i++){var attr = new Object();attr.text = options[i].firstChild?options[i].firstChild.nodeValue:"";for (var j=0;j<options[i].attributes.length;j++){var a = options[i].attributes[j];if (a)attr[a.nodeName] = a.nodeValue;}
 obj._addOption(attr);}
 obj.render(add!=true || (!!options.length));if ((obj._load)&&(obj._load!==true))
 obj.loadXML(obj._load);else{obj._load=false;if ((!obj._lkmode)&&(obj._filter)&&!obj._autoDisabled) {obj._correctSelection();}
 }
 var selected=xml.doXPath("//option[@selected]");if (selected.length)obj.selectOption(obj.getIndexByValue(selected[0].getAttribute("value")),false,true);obj.callEvent("onXLE",[]);}
 dhtmlXCombo.prototype.unSelectOption = function(){if (this._selOption)this._selOption.deselect();if(this._tempSel)this._tempSel.deselect();this._tempSel=this._selOption=null;}
 

 dhtmlXCombo.prototype.confirmValue = function(){this._confirmSelection();}
 
 
 dhtmlXCombo.prototype._confirmSelection = function(data,status){var text = this.getComboText();this.setComboText("");this.setComboText(text);if(arguments.length==0){var z=this.getOptionByLabel(this.DOMelem_input.value);data = z?z.value:this.DOMelem_input.value;status = (z==null);if (data==this.getActualValue()) return this._skipFocus = false;}
 if(!this._skipFocus&&!this._disabled){try{this.DOMelem_input.focus();}
 catch(err){};}
 this._skipFocus = false;this.DOMelem_hidden_input.value=data;this.DOMelem_hidden_input2.value = (status?"true":"false");this.callEvent("onChange",[]);this._activeMode=false;}
 dhtmlXCombo.prototype._resetSelection = function(data,status){var z=this.getOption(this.DOMelem_hidden_input.value);this.setComboValue(z?z.data()[0]:this.DOMelem_hidden_input.value)
 this.setComboText(z?z.data()[1]:this.DOMelem_hidden_input.value)
 }
 

 dhtmlXCombo.prototype.selectOption = function(ind,filter,conf){if (arguments.length<3)conf=true;this.unSelectOption();var z=this.optionsArr[ind];if (!z)return;this._selOption=z;this._selOption.select();var corr=this._selOption.content.offsetTop+this._selOption.content.offsetHeight-this.DOMlist.scrollTop-this.DOMlist.offsetHeight;if (corr>0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr;var data=this._selOption.data();if (conf){this.setComboText(data[1]);this._confirmSelection(data[0],false);if ((this._autoxml)&&((ind+1)==this._lastLength))
 this._fetchOptions(ind+1,this._lasttext||"");}
 if (filter){var text=this.getComboText();if (text!=data[1]){this.setComboText(data[1]);dhtmlXRange(this.DOMelem_input,text.length+1,data[1].length);}
 }
 else
 this.setComboText(data[1]);this._selOption.RedrawHeader(this);this.callEvent("onSelectionChange",[]);}
 dhtmlXCombo.prototype._selectOption = function(e)
 {(e||event).cancelBubble = true;var node=(_isIE?event.srcElement:e.target);var that=this.combo;while (!node._self){node = node.parentNode;if (!node)return;}
 var i=0;for (i;i<that.DOMlist.childNodes.length;i++){if (that.DOMlist.childNodes[i]==node)break;}
 that.selectOption(i,false,true);that.closeAll();that.callEvent("onBlur",[])
 that._activeMode=false;}
 dhtmlXCombo.prototype.openSelect = function(){if (this._disabled)return;this.closeAll();this.DOMlist.style.display="block";this._positList();this.callEvent("onOpen",[]);if(this._tempSel)this._tempSel.deselect();if(this._selOption)this._selOption.select();if(this._selOption){var corr=this._selOption.content.offsetTop+this._selOption.content.offsetHeight-this.DOMlist.scrollTop-this.DOMlist.offsetHeight;if (corr>0)this.DOMlist.scrollTop+=corr;corr=this.DOMlist.scrollTop-this._selOption.content.offsetTop;if (corr>0)this.DOMlist.scrollTop-=corr;}
 
 
 
 if (_isIE)this._IEFix(true);this.DOMelem_input.focus();if (this._filter)this.filterSelf();}
 dhtmlXCombo.prototype._toggleSelect = function(e)
 {var that=this.combo;if ( that.DOMlist.style.display == "block" ){that.closeAll();}else {that.openSelect();}
 (e||event).cancelBubble = true;}
 dhtmlXCombo.prototype._fetchOptions=function(ind,text){if (text==""){this.closeAll();return this.clearAll();}
 var url=this._xml+((this._xml.indexOf("?")!=-1)?"&":"?")+"pos="+ind+"&mask="+encodeURIComponent(text);this._lasttext=text;if (this._load)this._load=url;else {if (!this.callEvent("onDynXLS",[text,ind])) return;this.loadXML(url);}
 };dhtmlXCombo.prototype.disableAutocomplete = function()
 {this._autoDisabled = true;};dhtmlXCombo.prototype.filterSelf = function(mode)
 {var text=this.getComboText();if (this._xml){this._lkmode=mode;this._fetchOptions(0,text);}
 var escapeExp = new RegExp("(["+this.filterEntities.join("\\")+"])","g");text = text.replace(escapeExp,"\\$1");var filterExp = (this._anyPosition?"":"^")+text;var filter=new RegExp(filterExp,"i");this.filterAny=false;for(var i=0;i<this.optionsArr.length;i++){var z=filter.test(this.optionsArr[i].content?this.optionsArr[i].data()[1]:this.optionsArr[i].text);this.filterAny|=z;this.optionsArr[i].hide(!z);}
 if (!this.filterAny){this.closeAll();this._activeMode=true;}
 else {if (this.DOMlist.style.display!="block")this.openSelect();if (_isIE)this._IEFix(true);}
 
 if (!mode&&!this._autoDisabled){this._correctSelection();}
 else this.unSelectOption();}
 
 



 dhtmlXCombo.prototype._IEFix = function(mode){this.DOMlistF.style.display=(mode?"block":"none");this.DOMlistF.style.top=this.DOMlist.style.top;this.DOMlistF.style.left=this.DOMlist.style.left;this.DOMlistF.style.width=this.DOMlist.offsetWidth+"px";this.DOMlistF.style.height=this.DOMlist.offsetHeight+"px";};dhtmlXCombo.prototype.closeAll = function()
 {if(window.dhx_glbSelectAr)for (var i=0;i<dhx_glbSelectAr.length;i++){if (dhx_glbSelectAr[i].DOMlist.style.display=="block"){dhx_glbSelectAr[i].DOMlist.style.display = "none";if (_isIE)dhx_glbSelectAr[i]._IEFix(false);}
 dhx_glbSelectAr[i]._activeMode=false;}
 }
 dhtmlXCombo.prototype.changeOptionId = function(oldId,newId){(this.getOption(oldId)||{}).value = newId;};function dhtmlXRange(InputId, Start, End)
{var Input = typeof(InputId)=='object' ? InputId : document.getElementById(InputId);try{Input.focus();}catch(e){};var Length = Input.value.length;Start--;if (Start < 0 || Start > End || Start > Length)Start = 0;if (End > Length)End = Length;if (Start==End)return;if (Input.setSelectionRange){Input.setSelectionRange(Start, End);}else if (Input.createTextRange){var range = Input.createTextRange();range.moveStart('character', Start);range.moveEnd('character', End-Length);try{range.select();}
 catch(e){}
 }
}
 dhtmlXCombo_defaultOption = function(){this.init();}
 dhtmlXCombo_defaultOption.prototype.init = function(){this.value = null;this.text = "";this.selected = false;this.css = "";}
 dhtmlXCombo_defaultOption.prototype.select = function(){if (this.content){this.content.className="dhx_selected_option"+(dhtmlx.skin?" combo_"+dhtmlx.skin+"_sel":"");}
 }
 dhtmlXCombo_defaultOption.prototype.hide = function(mode){this.render().style.display=mode?"none":"";}
 dhtmlXCombo_defaultOption.prototype.isHidden = function(){return (this.render().style.display=="none");}
 dhtmlXCombo_defaultOption.prototype.deselect = function(){if (this.content)this.render();this.content.className="";}
dhtmlXCombo_defaultOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.content=null;}
 

 dhtmlXCombo_defaultOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;if (_isOpera || _isKHTML )this.content.style.padding="2px 0px 2px 0px";this.content.innerHTML=this.text;this._ctext=(typeof this.content.textContent!="undefined")?this.content.textContent:this.content.innerText;}
 return this.content;}
 dhtmlXCombo_defaultOption.prototype.data = function(){if (this.content)return [this.value,this._ctext ? this._ctext : this.text];}
dhtmlXCombo_defaultOption.prototype.DrawHeader = function(self, name, width, tab)
{var z=document.createElement("DIV");z.style.width = width+"px";z.className = 'dhx_combo_box '+(dhtmlx.skin||"");z._self = self;self.DOMelem = z;this._DrawHeaderInput(self, name, width,tab);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem);}
dhtmlXCombo_defaultOption.prototype._DrawHeaderInput = function(self, name, width,tab)
{var z=document.createElement('input');z.setAttribute("autocomplete","off");z.type = 'text';z.className = 'dhx_combo_input';if (tab)z.tabIndex=tab;z.style.width = width-19-(document.compatMode=="BackCompat"?0:3)+'px';self.DOMelem.appendChild(z);self.DOMelem_input = z;z = document.createElement('input');z.type = 'hidden';z.name = name;self.DOMelem.appendChild(z);self.DOMelem_hidden_input = z;z = document.createElement('input');z.type = 'hidden';z.name = (name||"").replace(/(\]?)$/, "_new_value$1");z.value="true";self.DOMelem.appendChild(z);self.DOMelem_hidden_input2 = z;}
dhtmlXCombo_defaultOption.prototype._DrawHeaderButton = function(self, name, width)
{var z=document.createElement('img');z.className = 'dhx_combo_img';if(dhtmlx.image_path)dhx_globalImgPath = dhtmlx.image_path;z.src = (window.dhx_globalImgPath?dhx_globalImgPath:"")+'combo_select'+(dhtmlx.skin?"_"+dhtmlx.skin:"")+'.gif';self.DOMelem.appendChild(z);self.DOMelem_button=z;}
dhtmlXCombo_defaultOption.prototype.RedrawHeader = function(self)
{}
dhtmlXCombo_optionTypes['default'] = dhtmlXCombo_defaultOption;dhtmlXCombo.prototype.dhx_Event=function()
{this.dhx_SeverCatcherPath="";this.attachEvent = function(original, catcher, CallObj)
 {CallObj = CallObj||this;original = 'ev_'+original;if ( ( !this[original] )|| ( !this[original].addEvent ) ) {var z = new this.eventCatcher(CallObj);z.addEvent( this[original] );this[original] = z;}
 return ( original + ':' + this[original].addEvent(catcher) );}
 this.callEvent=function(name,arg0){if (this["ev_"+name])return this["ev_"+name].apply(this,arg0);return true;}
 this.checkEvent=function(name){if (this["ev_"+name])return true;return false;}
 this.eventCatcher = function(obj)
 {var dhx_catch = new Array();var m_obj = obj;var func_server = function(catcher,rpc)
 {catcher = catcher.split(":");var postVar="";var postVar2="";var target=catcher[1];if (catcher[1]=="rpc"){postVar='<?xml version="1.0"?><methodCall><methodName>'+catcher[2]+'</methodName><params>';postVar2="</params></methodCall>";target=rpc;}
 var z = function() {}
 return z;}
 var z = function()
 {if (dhx_catch)var res=true;for (var i=0;i<dhx_catch.length;i++){if (dhx_catch[i] != null){var zr = dhx_catch[i].apply( m_obj, arguments );res = res && zr;}
 }
 return res;}
 z.addEvent = function(ev)
 {if ( typeof(ev)!= "function" )
 if (ev && ev.indexOf && ev.indexOf("server:")== 0)
 ev = new func_server(ev,m_obj.rpcServer);else
 ev = eval(ev);if (ev)return dhx_catch.push( ev ) - 1;return false;}
 z.removeEvent = function(id)
 {dhx_catch[id] = null;}
 return z;}
 this.detachEvent = function(id)
 {if (id != false){var list = id.split(':');this[ list[0] ].removeEvent( list[1] );}
 }
};(function(){dhtmlx.extend_api("dhtmlXCombo",{_init:function(obj){if (obj.image_path)dhx_globalImgPath=obj.image_path;return [obj.parent, obj.name, (obj.width||"100%"), obj.type, obj.index ];},
 filter:"filter_command",
 auto_height:"enableOptionAutoHeight",
 auto_position:"enableOptionAutoPositioning",
 auto_width:"enableOptionAutoWidth",
 xml:"loadXML",
 readonly:"readonly",
 items:"addOption"
 },{filter_command:function(data){if (typeof data == "string")this.enableFilteringMode(true,data);else
 this.enableFilteringMode(data);}
 });})();dhtmlXCombo_imageOption = function(){this.init();}
dhtmlXCombo_imageOption.prototype = new dhtmlXCombo_defaultOption;dhtmlXCombo_imageOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.img_src = attr.img_src||this.getDefImage();}
dhtmlXCombo_imageOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;var html = '';if (this.img_src != '')html += '<img style="float:left;" src="'+this.img_src+'" />';html += '<div style="float:left">'+this.text+'</div>';this.content.innerHTML=html;}
 return this.content;}
dhtmlXCombo_imageOption.prototype.data = function(){return [this.value,this.text,this.img_src];}
dhtmlXCombo_imageOption.prototype.DrawHeader = function(self, name, width)
{var z=document.createElement("DIV");z.style.width = width+"px";z.className = 'dhx_combo_box';z._self = self;self.DOMelem = z;this._DrawHeaderImage(self, name, width);this._DrawHeaderInput(self, name, width-19);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem);}
dhtmlXCombo_imageOption.prototype._DrawHeaderImage = function(self, name, width)
{var z= document.createElement('img');z.className = 'dhx_combo_option_img';z.style.visibility = 'hidden';self.DOMelem.appendChild(z);self.DOMelem_image=z;}
dhtmlXCombo_imageOption.prototype.RedrawHeader = function(self,hide)
{self.DOMelem_image.style.visibility = hide?'hidden':'visible';self.DOMelem_image.src = hide?"":this.img_src;}
dhtmlXCombo_imageOption.prototype.getDefImage = function(self){return "";}
dhtmlXCombo.prototype.setDefaultImage=function(url){dhtmlXCombo_imageOption.prototype.getDefImage=function(){return url;}
}
dhtmlXCombo_optionTypes['image'] = dhtmlXCombo_imageOption;dhtmlXCombo_checkboxOption = function(){this.init();}
dhtmlXCombo_checkboxOption.prototype = new dhtmlXCombo_defaultOption;dhtmlXCombo_checkboxOption.prototype.setValue = function(attr){this.value = attr.value||"";this.text = attr.text||"";this.css = attr.css||"";this.checked = attr.checked||0;}
dhtmlXCombo_checkboxOption.prototype.render = function(){if (!this.content){this.content=document.createElement("DIV");this.content._self = this;this.content.style.cssText='width:100%;overflow:hidden;'+this.css;var html = '';if(this.checked)html += '<input style="float:left;" type="checkbox" checked />';else html += '<input style="float:left;" type="checkbox" />';html += '<div style="float:left">'+this.text+'</div>';this.content.innerHTML=html;this.content.firstChild.onclick = function(e) {this.parentNode.parentNode.combo.DOMelem_input.focus();(e||event).cancelBubble=true;if(!this.parentNode.parentNode.combo.callEvent("onCheck",[this.parentNode._self.value,this.checked])){this.checked=!this.checked;return false;}
 }
 }
 return this.content;}
dhtmlXCombo_checkboxOption.prototype.data = function(){return [this.value,this.text,this.render().firstChild.checked];}
dhtmlXCombo_checkboxOption.prototype.DrawHeader = function(self, name, width)
{self.DOMelem = document.createElement("DIV");self.DOMelem.style.width = width+"px";self.DOMelem.className = 'dhx_combo_box';self.DOMelem._self = self;this._DrawHeaderCheckbox(self, name, width);this._DrawHeaderInput(self, name, width-19);this._DrawHeaderButton(self, name, width);self.DOMParent.appendChild(self.DOMelem);}
dhtmlXCombo_checkboxOption.prototype._DrawHeaderCheckbox = function(self, name, width)
{var z= document.createElement('input');z.type='checkbox';z.className = 'dhx_combo_option_img';z.style.visibility = 'hidden';z.onclick = function(e) {var index = self.getIndexByValue(self.getActualValue());if(index!=-1){self.setChecked(index,z.checked);self.callEvent("onCheck",[self.getActualValue(), self.optionsArr[index].content.firstChild.checked]);}
 (e||event).cancelBubble=true;}
 self.DOMelem.appendChild(z);self.DOMelem_checkbox = z;}
dhtmlXCombo_checkboxOption.prototype.RedrawHeader = function(self,hide)
{self.DOMelem_checkbox.style.visibility = hide?'hidden':'';self.DOMelem_checkbox.checked = hide?false:this.content.firstChild.checked;}
dhtmlXCombo_optionTypes['checkbox'] = dhtmlXCombo_checkboxOption;dhtmlXCombo.prototype.getChecked=function(){var res=[];for(var i=0;i<this.optionsArr.length;i++)if(this.optionsArr[i].data()[2])
 res.push(this.optionsArr[i].value)
 return res;}
dhtmlXCombo.prototype.setChecked=function(index,mode){this.optionsArr[index].content.firstChild.checked=(!(mode===false));if (this._selOption == this.optionsArr[index])this._selOption.RedrawHeader(this);}
dhtmlXCombo.prototype.setCheckedByValue=function(value,mode){return this.setChecked(this.getIndexByValue(value),mode);}
dhtmlXCombo.prototype.enableOptionAutoPositioning = function(fl){if(!this.ListAutoPosit)this.ListAutoPosit = 1;this.attachEvent("onOpen",function(){this._setOptionAutoPositioning(fl);})
 this.attachEvent("onXLE",function(){this._setOptionAutoPositioning(fl);})
 
}
dhtmlXCombo.prototype._setOptionAutoPositioning = function(fl){if((typeof(fl)!="undefined")&&(!convertStringToBoolean(fl))){this.ListPosition = "Bottom";this.ListAutoPosit = 0;return true
 }
 
 var pos = this.getPosition(this.DOMelem);var bottom = this._getClientHeight() - pos[1] - this.DOMelem.offsetHeight;var height = (this.autoHeight)?(this.DOMlist.scrollHeight):parseInt(this.DOMlist.offsetHeight);if((bottom < height)&&(pos[1] > height)){this.ListPosition = "Top";}
 else this.ListPosition = "Bottom";this._positList();if(_isIE)this._IEFix(true);}
dhtmlXCombo.prototype._getClientHeight = function(){return ((document.compatMode=='CSS1Compat') &&(!window.opera))?document.documentElement.clientHeight:document.body.clientHeight;}
dhtmlXCombo.prototype.setOptionWidth = function(width){if(arguments.length > 0){this.DOMlist.style.width = width+"px";if (this.DOMlistF)this.DOMlistF.style.width = width+"px";}
}
dhtmlXCombo.prototype.setOptionHeight = function(height){if(arguments.length>0){if(_isIE)this.DOMlist.style.height = this.DOMlistF.style.height = height+"px";else
 this.DOMlist.style.height = height+"px";if(this.DOMlistF)this.DOMlistF.style.height = this.DOMlist.style.height;this._positList();}
 
}
dhtmlXCombo.prototype.enableOptionAutoWidth = function(fl){if(!this._listWidthConf)this._listWidthConf = this.DOMlist.offsetWidth;if(arguments.length == 0){var fl = 1;}
 if(convertStringToBoolean(fl)) {this.autoOptionWidth = 1;this.awOnOpen = this.attachEvent("onOpen",function(){this._setOptionAutoWidth()});this.awOnXLE = this.attachEvent("onXLE",function(){this._setOptionAutoWidth()});}
 else {if(typeof(this.awOnOpen)!= "undefined"){this.autoOptionWidth = 0;this.detachEvent(this.awOnOpen);this.detachEvent(this.awOnXLE);this.setOptionWidth(this._listWidthConf);}
 }
}


dhtmlXCombo.prototype._setOptionAutoWidth = function(){var isScroll = !this.ahOnOpen&&this.DOMlist.scrollHeight>this.DOMlist.offsetHeight;this.setOptionWidth(1);var x = this.DOMlist.offsetWidth;for ( var i=0;i<this.optionsArr.length;i++){var optWidth = (_isFF)?(this.DOMlist.childNodes[i].scrollWidth - 2):this.DOMlist.childNodes[i].scrollWidth;if (optWidth > x){x = this.DOMlist.childNodes[i].scrollWidth;}
 }
 x += isScroll?18:0;this.setOptionWidth((this.DOMelem.offsetWidth>x)?this.DOMelem.offsetWidth:x+2);}
dhtmlXCombo.prototype.enableOptionAutoHeight = function(fl,maxHeight){if(!this._listHeightConf)this._listHeightConf = (this.DOMlist.style.height=="")?100:parseInt(this.DOMlist.style.height);if(arguments.length==0)var fl = 1;this.autoHeight = convertStringToBoolean(fl);var combo = this;if(this.autoHeight){var f = function(){window.setTimeout(function(){combo._setOptionAutoHeight(fl,maxHeight)},1)
 }
 this.ahOnOpen = this.attachEvent("onOpen",f);if(!this.awOnOpen)this.ahOnXLE = this.attachEvent("onXLE",f);var t;this.ahOnKey = this.attachEvent("onKeyPressed",function(){if(!this._filter)return;if(t)window.clearTimeout(t);window.setTimeout(function(){if(combo.DOMlist.style.display=="block")combo._setOptionAutoHeight(fl,maxHeight);},50)
 });}
 else {if(typeof(this.ahOnOpen)!= "undefined"){this.detachEvent(this.ahOnOpen);if(this.ahOnXLE)this.detachEvent(this.ahOnXLE);if(this.ahOnKey)this.detachEvent(this.ahOnKey);this.setOptionHeight(this._listHeightConf);}
 }
 
}
 

dhtmlXCombo.prototype._setOptionAutoHeight = function(fl,maxHeight){if(convertStringToBoolean(fl)){this.setOptionHeight(1);var height = 0;if (this.optionsArr.length > 0){if(this.DOMlist.scrollHeight > this.DOMlist.offsetHeight){height= this.DOMlist.scrollHeight + 2;}
 else height= this.DOMlist.offsetHeight;if((arguments.length > 1)&&(maxHeight)){var maxHeight = parseInt(maxHeight);height = (height>maxHeight)?maxHeight:height;}
 
 this.setOptionHeight(height)
 }
 else this.DOMlist.style.display="none";}
}
 




dhtmlXCombo.prototype.attachChildCombo = function(_chcombo,xml){if(!this._child_combos){this._child_combos = [];}
 
 this._has_childen = 1;this._child_combos[this._child_combos.length] = _chcombo;_chcombo.show(0);var that = this;var _arg_length = arguments.length;this.attachEvent("onChange",function(){for(var i = 0;i < that._child_combos.length;i++){if(that._child_combos[i]==_chcombo){_chcombo.show(1);_chcombo.callEvent("onMasterChange",[that.getActualValue(),that]);}
 
 }
 
 if(that.getActualValue()=="") {that.showSubCombo(that,0);return;}
 
 if(_chcombo._xml){if(_arg_length ==1)xml = _chcombo._xml;_chcombo._xml = that.deleteParentVariable(xml);_chcombo._xml += ((_chcombo._xml.indexOf("?")!=-1)?"&":"?")+"parent="+encodeURIComponent(that.getActualValue());}
 else{if(xml){_chcombo.clearAll(true);_chcombo.loadXML(xml+((xml.indexOf("?")!=-1)?"&":"?")+"parent="+encodeURIComponent(that.getActualValue()));}
 
 }
 })
}
dhtmlXCombo.prototype.setAutoSubCombo = function(xml,name){if(arguments.length == 1)name = "subcombo";if(!this._parentCombo){var z = new dhtmlXCombo(this.DOMParent,name,this.DOMelem.style.width)
 z._parentCombo = this;}
 else {var z = new dhtmlXCombo(this._parentCombo.DOMParent,name,this._parentCombo.DOMelem.style.width)
 z._parentCombo = this._parentCombo;}
 if(this._filter)z._filter = 1;if(this._xml){if(arguments.length > 0)z._xml = xml;else 
 z._xml = this._xml;xml = z._xml;z._autoxml = this._autoxml;if(this._xmlCache)z._xmlCache=[];}
 
 this.attachChildCombo(z,xml) 
 return z;}
dhtmlXCombo.prototype.detachChildCombo = function(_chcombo){for(var i = 0;i < this._child_combos.length;i++){this._child_combos[i] == _chcombo;this._child_combos.splice(i,1);}
 _chcombo.show(1);}
dhtmlXCombo.prototype.showSubCombo = function(combo,state){if(combo._child_combos){for(var i = 0;i < combo._child_combos.length;i++){combo._child_combos[i].show(state);combo.showSubCombo(combo._child_combos[i],0);}
 }
}
dhtmlXCombo.prototype.deleteParentVariable = function(str){str = str.replace(/parent\=[^&]*/g,"").replace(/\?\&/,"?");return str;}
 




function dataProcessor(serverProcessorURL){this.serverProcessor = serverProcessorURL;this.action_param="!nativeeditor_status";this.object = null;this.updatedRows = [];this.autoUpdate = true;this.updateMode = "cell";this._tMode="GET";this.post_delim = "_";this._waitMode=0;this._in_progress={};this._invalid={};this.mandatoryFields=[];this.messages=[];this.styles={updated:"font-weight:bold;",
 inserted:"font-weight:bold;",
 deleted:"text-decoration : line-through;",
 invalid:"background-color:FFE0E0;",
 invalid_cell:"border-bottom:2px solid red;",
 error:"color:red;",
 clear:"font-weight:normal;text-decoration:none;"
 };this.enableUTFencoding(true);dhtmlxEventable(this);return this;}
dataProcessor.prototype={setTransactionMode:function(mode,total){this._tMode=mode;this._tSend=total;},
 escape:function(data){if (this._utf)return encodeURIComponent(data);else
 return escape(data);},
 
 enableUTFencoding:function(mode){this._utf=convertStringToBoolean(mode);},
 
 setDataColumns:function(val){this._columns=(typeof val == "string")?val.split(","):val;},
 
 getSyncState:function(){return !this.updatedRows.length;},
 
 enableDataNames:function(mode){this._endnm=convertStringToBoolean(mode);},
 
 enablePartialDataSend:function(mode){this._changed=convertStringToBoolean(mode);},
 
 setUpdateMode:function(mode,dnd){this.autoUpdate = (mode=="cell");this.updateMode = mode;this.dnd=dnd;},
 ignore:function(code,master){this._silent_mode=true;code.call(master||window);this._silent_mode=false;},
 
 setUpdated:function(rowId,state,mode){if (this._silent_mode)return;var ind=this.findRow(rowId);mode=mode||"updated";var existing = this.obj.getUserData(rowId,this.action_param);if (existing && mode == "updated")mode=existing;if (state){this.set_invalid(rowId,false);this.updatedRows[ind]=rowId;this.obj.setUserData(rowId,this.action_param,mode);if (this._in_progress[rowId])this._in_progress[rowId]="wait";}else{if (!this.is_invalid(rowId)){this.updatedRows.splice(ind,1);this.obj.setUserData(rowId,this.action_param,"");}
 }
 
 if (!state)this._clearUpdateFlag(rowId);this.markRow(rowId,state,mode);if (state && this.autoUpdate)this.sendData(rowId);},
 _clearUpdateFlag:function(id){},
 markRow:function(id,state,mode){var str="";var invalid=this.is_invalid(id);if (invalid){str=this.styles[invalid];state=true;}
 if (this.callEvent("onRowMark",[id,state,mode,invalid])){str=this.styles[state?mode:"clear"]+str;this.obj[this._methods[0]](id,str);if (invalid && invalid.details){str+=this.styles[invalid+"_cell"];for (var i=0;i < invalid.details.length;i++)if (invalid.details[i])this.obj[this._methods[1]](id,i,str);}
 }
 },
 getState:function(id){return this.obj.getUserData(id,this.action_param);},
 is_invalid:function(id){return this._invalid[id];},
 set_invalid:function(id,mode,details){if (details)mode={value:mode, details:details, toString:function(){return this.value.toString();}};this._invalid[id]=mode;},
 
 checkBeforeUpdate:function(rowId){return true;},
 
 sendData:function(rowId){if (this._waitMode && (this.obj.mytype=="tree" || this.obj._h2)) return;if (this.obj.editStop)this.obj.editStop();if(typeof rowId == "undefined" || this._tSend)return this.sendAllData();if (this._in_progress[rowId])return false;this.messages=[];if (!this.checkBeforeUpdate(rowId)&& this.callEvent("onValidationError",[rowId,this.messages])) return false;this._beforeSendData(this._getRowData(rowId),rowId);},
 _beforeSendData:function(data,rowId){if (!this.callEvent("onBeforeUpdate",[rowId,this.getState(rowId),data])) return false;this._sendData(data,rowId);},
 serialize:function(data, id){if (typeof data == "string")return data;if (typeof id != "undefined")return this.serialize_one(data,"");else{var stack = [];var keys = [];for (var key in data)if (data.hasOwnProperty(key)){stack.push(this.serialize_one(data[key],key+this.post_delim));keys.push(key);}
 stack.push("ids="+this.escape(keys.join(",")));if (dhtmlx.security_key)stack.push("dhx_security="+dhtmlx.security_key);return stack.join("&");}
 },
 serialize_one:function(data, pref){if (typeof data == "string")return data;var stack = [];for (var key in data)if (data.hasOwnProperty(key))
 stack.push(this.escape((pref||"")+key)+"="+this.escape(data[key]));return stack.join("&");},
 _sendData:function(a1,rowId){if (!a1)return;if (!this.callEvent("onBeforeDataSending",rowId?[rowId,this.getState(rowId),a1]:[null, null, a1])) return false;if (rowId)this._in_progress[rowId]=(new Date()).valueOf();var a2=new dtmlXMLLoaderObject(this.afterUpdate,this,true);var a3 = this.serverProcessor+(this._user?(getUrlSymbol(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+this.obj.getUserData(0,"version")].join("&")):"");if (this._tMode!="POST")a2.loadXML(a3+((a3.indexOf("?")!=-1)?"&":"?")+this.serialize(a1,rowId));else
 a2.loadXML(a3,true,this.serialize(a1,rowId));this._waitMode++;},
 sendAllData:function(){if (!this.updatedRows.length)return;this.messages=[];var valid=true;for (var i=0;i<this.updatedRows.length;i++)valid&=this.checkBeforeUpdate(this.updatedRows[i]);if (!valid && !this.callEvent("onValidationError",["",this.messages])) return false;if (this._tSend)this._sendData(this._getAllData());else
 for (var i=0;i<this.updatedRows.length;i++)if (!this._in_progress[this.updatedRows[i]]){if (this.is_invalid(this.updatedRows[i])) continue;this._beforeSendData(this._getRowData(this.updatedRows[i]),this.updatedRows[i]);if (this._waitMode && (this.obj.mytype=="tree" || this.obj._h2)) return;}
 },
 
 
 
 
 
 
 
 
 _getAllData:function(rowId){var out={};var has_one = false;for(var i=0;i<this.updatedRows.length;i++){var id=this.updatedRows[i];if (this._in_progress[id] || this.is_invalid(id)) continue;if (!this.callEvent("onBeforeUpdate",[id,this.getState(id)])) continue;out[id]=this._getRowData(id,id+this.post_delim);has_one = true;this._in_progress[id]=(new Date()).valueOf();}
 return has_one?out:null;},
 
 
 
 setVerificator:function(ind,verifFunction){this.mandatoryFields[ind] = verifFunction||(function(value){return (value!="");});},
 
 clearVerificator:function(ind){this.mandatoryFields[ind] = false;},
 
 
 
 
 
 findRow:function(pattern){var i=0;for(i=0;i<this.updatedRows.length;i++)if(pattern==this.updatedRows[i])break;return i;},

 
 


 





 
 defineAction:function(name,handler){if (!this._uActions)this._uActions=[];this._uActions[name]=handler;},




 
 afterUpdateCallback:function(sid, tid, action, btag) {var marker = sid;var correct=(action!="error" && action!="invalid");if (!correct)this.set_invalid(sid,action);if ((this._uActions)&&(this._uActions[action])&&(!this._uActions[action](btag))) 
 return (delete this._in_progress[marker]);if (this._in_progress[marker]!="wait")this.setUpdated(sid, false);var soid = sid;switch (action) {case "inserted":
 case "insert":
 if (tid != sid){this.obj[this._methods[2]](sid, tid);sid = tid;}
 break;case "delete":
 case "deleted":
 this.obj.setUserData(sid, this.action_param, "true_deleted");this.obj[this._methods[3]](sid);delete this._in_progress[marker];return this.callEvent("onAfterUpdate", [sid, action, tid, btag]);break;}
 
 if (this._in_progress[marker]!="wait"){if (correct)this.obj.setUserData(sid, this.action_param,'');delete this._in_progress[marker];}else {delete this._in_progress[marker];this.setUpdated(tid,true,this.obj.getUserData(sid,this.action_param));}
 
 this.callEvent("onAfterUpdate", [sid, action, tid, btag]);},

 
 afterUpdate:function(that,b,c,d,xml){xml.getXMLTopNode("data");if (!xml.xmlDoc.responseXML)return;var atag=xml.doXPath("//data/action");for (var i=0;i<atag.length;i++){var btag=atag[i];var action = btag.getAttribute("type");var sid = btag.getAttribute("sid");var tid = btag.getAttribute("tid");that.afterUpdateCallback(sid,tid,action,btag);}
 that.finalizeUpdate();},
 finalizeUpdate:function(){if (this._waitMode)this._waitMode--;if ((this.obj.mytype=="tree" || this.obj._h2)&& this.updatedRows.length) 
 this.sendData();this.callEvent("onAfterUpdateFinish",[]);if (!this.updatedRows.length)this.callEvent("onFullSync",[]);},




 
 
 init:function(anObj){this.obj = anObj;if (this.obj._dp_init)this.obj._dp_init(this);},
 
 
 setOnAfterUpdate:function(ev){this.attachEvent("onAfterUpdate",ev);},
 enableDebug:function(mode){},
 setOnBeforeUpdateHandler:function(func){this.attachEvent("onBeforeDataSending",func);},



 
 setAutoUpdate: function(interval, user) {interval = interval || 2000;this._user = user || (new Date()).valueOf();this._need_update = false;this._loader = null;this._update_busy = false;this.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){this.afterAutoUpdate(sid, action, tid, xml_node);});this.attachEvent("onFullSync",function(){this.fullSync();});var self = this;window.setInterval(function(){self.loadUpdate();}, interval);},


 
 afterAutoUpdate: function(sid, action, tid, xml_node) {if (action == 'collision'){this._need_update = true;return false;}else {return true;}
 },


 
 fullSync: function() {if (this._need_update == true){this._need_update = false;this.loadUpdate();}
 return true;},


 
 getUpdates: function(url,callback){if (this._update_busy)return false;else
 this._update_busy = true;this._loader = this._loader || new dtmlXMLLoaderObject(true);this._loader.async=true;this._loader.waitCall=callback;this._loader.loadXML(url);},


 
 _v: function(node) {if (node.firstChild)return node.firstChild.nodeValue;return "";},


 
 _a: function(arr) {var res = [];for (var i=0;i < arr.length;i++){res[i]=this._v(arr[i]);};return res;},


 
 loadUpdate: function(){var self = this;var version = this.obj.getUserData(0,"version");var url = this.serverProcessor+getUrlSymbol(this.serverProcessor)+["dhx_user="+this._user,"dhx_version="+version].join("&");url = url.replace("editing=true&","");this.getUpdates(url, function(){var vers = self._loader.doXPath("//userdata");self.obj.setUserData(0,"version",self._v(vers[0]));var upds = self._loader.doXPath("//update");if (upds.length){self._silent_mode = true;for (var i=0;i<upds.length;i++){var status = upds[i].getAttribute('status');var id = upds[i].getAttribute('id');var parent = upds[i].getAttribute('parent');switch (status) {case 'inserted':
 self.callEvent("insertCallback",[upds[i], id, parent]);break;case 'updated':
 self.callEvent("updateCallback",[upds[i], id, parent]);break;case 'deleted':
 self.callEvent("deleteCallback",[upds[i], id, parent]);break;}
 }
 
 self._silent_mode = false;}
 
 self._update_busy = false;self = null;});}
};if (!window.dhtmlx)dhtmlx={};dhtmlx.assert = function(test, message){if (!test)dhtmlx.error(message);};dhtmlx.assert_enabled=function(){return false;};dhtmlx.assert_event = function(obj, evs){if (!obj._event_check){obj._event_check = {};obj._event_check_size = {};}
 
 for (var a in evs){obj._event_check[a.toLowerCase()]=evs[a];var count=-1;for (var t in evs[a])count++;obj._event_check_size[a.toLowerCase()]=count;}
};dhtmlx.assert_method_info=function(obj, name, descr, rules){var args = [];for (var i=0;i < rules.length;i++){args.push(rules[i][0]+" : "+rules[i][1]+"\n "+rules[i][2].describe()+(rules[i][3]?";optional":""));}
 return obj.name+"."+name+"\n"+descr+"\n Arguments:\n - "+args.join("\n - ");};dhtmlx.assert_method = function(obj, config){for (var key in config)dhtmlx.assert_method_process(obj, key, config[key].descr, config[key].args, (config[key].min||99), config[key].skip);};dhtmlx.assert_method_process = function (obj, name, descr, rules, min, skip){var old = obj[name];if (!skip)obj[name] = function(){if (arguments.length != rules.length && arguments.length < min)dhtmlx.log("warn","Incorrect count of parameters\n"+obj[name].describe()+"\n\nExpecting "+rules.length+" but have only "+arguments.length);else
 for (var i=0;i<rules.length;i++)if (!rules[i][3] && !rules[i][2](arguments[i]))
 dhtmlx.log("warn","Incorrect method call\n"+obj[name].describe()+"\n\nActual value of "+(i+1)+" parameter: {"+(typeof arguments[i])+"}"+arguments[i]);return old.apply(this, arguments);};obj[name].describe = function(){return dhtmlx.assert_method_info(obj, name, descr, rules);};};dhtmlx.assert_event_call = function(obj, name, args){if (obj._event_check){if (!obj._event_check[name])dhtmlx.log("warn","Not expected event call :"+name);else if (dhtmlx.isNotDefined(args))
 dhtmlx.log("warn","Event without parameters :"+name);else if (obj._event_check_size[name] != args.length)dhtmlx.log("warn","Incorrect event call, expected "+obj._event_check_size[name]+" parameter(s), but have "+args.length +" parameter(s), for "+name+" event");}
};dhtmlx.assert_event_attach = function(obj, name){if (obj._event_check && !obj._event_check[name])dhtmlx.log("warn","Unknown event name: "+name);};dhtmlx.assert_property = function(obj, evs){if (!obj._settings_check)obj._settings_check={};dhtmlx.extend(obj._settings_check, evs);};dhtmlx.assert_check = function(data,coll){if (typeof data == "object"){for (var key in data){dhtmlx.assert_settings(key,data[key],coll);}
 }
};dhtmlx.assert_settings = function(mode,value,coll){coll = coll || this._settings_check;if (coll){if (!coll[mode])return dhtmlx.log("warn","Unknown propery: "+mode);var descr = "";var error = "";var check = false;for (var i=0;i<coll[mode].length;i++){var rule = coll[mode][i];if (typeof rule == "string")continue;if (typeof rule == "function")check = check || rule(value);else if (typeof rule == "object" && typeof rule[1] == "function"){check = check || rule[1](value);if (check && rule[2])dhtmlx["assert_check"](value, rule[2]);}
 if (check)break;}
 if (!check )dhtmlx.log("warn","Invalid configuration\n"+dhtmlx.assert_info(mode,coll)+"\nActual value: {"+(typeof value)+"}"+value);}
};dhtmlx.assert_info=function(name, set){var ruleset = set[name];var descr = "";var expected = [];for (var i=0;i<ruleset.length;i++){if (typeof rule == "string")descr = ruleset[i];else if (ruleset[i].describe)expected.push(ruleset[i].describe());else if (ruleset[i][1] && ruleset[i][1].describe)expected.push(ruleset[i][1].describe());}
 return "Property: "+name+", "+descr+" \nExpected value: \n - "+expected.join("\n - ");};if (dhtmlx.assert_enabled()){dhtmlx.assert_rule_color=function(check){if (typeof check != "string")return false;if (check.indexOf("#")!==0) return false;if (check.substr(1).replace(/[0-9A-F]/gi,"")!=="") return false;return true;};dhtmlx.assert_rule_color.describe = function(){return "{String}Value must start from # and contain hexadecimal code of color";};dhtmlx.assert_rule_template=function(check){if (typeof check == "function")return true;if (typeof check == "string")return true;return false;};dhtmlx.assert_rule_template.describe = function(){return "{Function},{String}Value must be a function which accepts data object and return text string, or a sting with optional template markers";};dhtmlx.assert_rule_boolean=function(check){if (typeof check == "boolean")return true;return false;};dhtmlx.assert_rule_boolean.describe = function(){return "{Boolean}true or false";};dhtmlx.assert_rule_object=function(check, sub){if (typeof check == "object")return true;return false;};dhtmlx.assert_rule_object.describe = function(){return "{Object}Configuration object";};dhtmlx.assert_rule_string=function(check){if (typeof check == "string")return true;return false;};dhtmlx.assert_rule_string.describe = function(){return "{String}Plain string";};dhtmlx.assert_rule_htmlpt=function(check){return !!dhtmlx.toNode(check);};dhtmlx.assert_rule_htmlpt.describe = function(){return "{Object},{String}HTML node or ID of HTML Node";};dhtmlx.assert_rule_notdocumented=function(check){return false;};dhtmlx.assert_rule_notdocumented.describe = function(){return "This options wasn't documented";};dhtmlx.assert_rule_key=function(obj){var t = function (check){return obj[check];};t.describe=function(){var opts = [];for(var key in obj)opts.push(key);return "{String}can take one of next values: "+opts.join(", ");};return t;};dhtmlx.assert_rule_dimension=function(check){if (check*1 == check && !isNaN(check)&& check >= 0) return true;return false;};dhtmlx.assert_rule_dimension.describe=function(){return "{Integer}value must be a positive number";};dhtmlx.assert_rule_number=function(check){if (typeof check == "number")return true;return false;};dhtmlx.assert_rule_number.describe=function(){return "{Integer}value must be a number";};dhtmlx.assert_rule_function=function(check){if (typeof check == "function")return true;return false;};dhtmlx.assert_rule_function.describe=function(){return "{Function}value must be a custom function";};dhtmlx.assert_rule_any=function(check){return true;};dhtmlx.assert_rule_any.describe=function(){return "Any value";};dhtmlx.assert_rule_mix=function(a,b){var t = function(check){if (a(check)||b(check)) return true;return false;};t.describe = function(){return a.describe();};return t;};}
dhtmlx.version="3.0";dhtmlx.codebase="./";dhtmlx.copy = function(source){var f = dhtmlx.copy._function;f.prototype = source;return new f();};dhtmlx.copy._function = function(){};dhtmlx.extend = function(target, source){for (var method in source)target[method] = source[method];if (dhtmlx.assert_enabled()&& source._assert){target._assert();target._assert=null;}
 
 dhtmlx.assert(target,"Invalid nesting target");dhtmlx.assert(source,"Invalid nesting source");if (source._init)target._init();return target;};dhtmlx.proto_extend = function(){var origins = arguments;var compilation = origins[0];var construct = [];for (var i=origins.length-1;i>0;i--){if (typeof origins[i]== "function")origins[i]=origins[i].prototype;for (var key in origins[i]){if (key == "_init")construct.push(origins[i][key]);else if (!compilation[key])compilation[key] = origins[i][key];}
 };if (origins[0]._init)construct.push(origins[0]._init);compilation._init = function(){for (var i=0;i<construct.length;i++)construct[i].apply(this, arguments);};compilation.base = origins[1];var result = function(config){this._init(config);if (this._parseSettings)this._parseSettings(config, this.defaults);};result.prototype = compilation;compilation = origins = null;return result;};dhtmlx.bind=function(functor, object){return function(){return functor.apply(object,arguments);};};dhtmlx.require=function(module){if (!dhtmlx._modules[module]){dhtmlx.assert(dhtmlx.ajax,"load module is required");dhtmlx.exec( dhtmlx.ajax().sync().get(dhtmlx.codebase+module).responseText );dhtmlx._modules[module]=true;}
};dhtmlx._modules = {};dhtmlx.exec=function(code){if (window.execScript)window.execScript(code);else window.eval(code);};dhtmlx.methodPush=function(object,method,event){return function(){var res = false;res=object[method].apply(object,arguments);return res;};};dhtmlx.isNotDefined=function(a){return typeof a == "undefined";};dhtmlx.delay=function(method, obj, params, delay){setTimeout(function(){var ret = method.apply(obj,params);method = obj = params = null;return ret;},delay||1);};dhtmlx.uid = function(){if (!this._seed)this._seed=(new Date).valueOf();this._seed++;return this._seed;};dhtmlx.toNode = function(node){if (typeof node == "string")return document.getElementById(node);return node;};dhtmlx.toArray = function(array){return dhtmlx.extend((array||[]),dhtmlx.PowerArray);};dhtmlx.toFunctor=function(str){return (typeof(str)=="string") ? eval(str) : str;};dhtmlx._events = {};dhtmlx.event=function(node,event,handler,master){node = dhtmlx.toNode(node);var id = dhtmlx.uid();dhtmlx._events[id]=[node,event,handler];if (master)handler=dhtmlx.bind(handler,master);if (node.addEventListener)node.addEventListener(event, handler, false);else if (node.attachEvent)node.attachEvent("on"+event, handler);return id;};dhtmlx.eventRemove=function(id){if (!id)return;dhtmlx.assert(this._events[id],"Removing non-existing event");var ev = dhtmlx._events[id];if (ev[0].removeEventListener)ev[0].removeEventListener(ev[1],ev[2],false);else if (ev[0].detachEvent)ev[0].detachEvent("on"+ev[1],ev[2]);delete this._events[id];};dhtmlx.log = function(type,message,details){if (window.console && console.log){type=type.toLowerCase();if (window.console[type])window.console[type](message||"unknown error");else
 window.console.log(type +": "+message);if (details)window.console.log(details);}
};dhtmlx.log_full_time = function(name){dhtmlx._start_time_log = new Date();dhtmlx.log("Info","Timing start ["+name+"]");window.setTimeout(function(){var time = new Date();dhtmlx.log("Info","Timing end ["+name+"]:"+(time.valueOf()-dhtmlx._start_time_log.valueOf())/1000+"s");},1);};dhtmlx.log_time = function(name){var fname = "_start_time_log"+name;if (!dhtmlx[fname]){dhtmlx[fname] = new Date();dhtmlx.log("Info","Timing start ["+name+"]");}else {var time = new Date();dhtmlx.log("Info","Timing end ["+name+"]:"+(time.valueOf()-dhtmlx[fname].valueOf())/1000+"s");dhtmlx[fname] = null;}
};dhtmlx.error = function(message,details){dhtmlx.log("error",message,details);};dhtmlx.EventSystem={_init:function(){this._events = {};this._handlers = {};this._map = {};},
 
 block : function(){this._events._block = true;},
 
 unblock : function(){this._events._block = false;},
 mapEvent:function(map){dhtmlx.extend(this._map, map);},
 
 callEvent:function(type,params){if (this._events._block)return true;type = type.toLowerCase();dhtmlx.assert_event_call(this, type, params);var event_stack =this._events[type.toLowerCase()];var return_value = true;if (dhtmlx.debug)dhtmlx.log("info","["+this.name+"] event:"+type,params);if (event_stack)for(var i=0;i<event_stack.length;i++)if (event_stack[i].apply(this,(params||[]))===false) return_value=false;if (this._map[type] && !this._map[type].callEvent(type,params))
 return_value = false;return return_value;},
 
 attachEvent:function(type,functor,id){type=type.toLowerCase();dhtmlx.assert_event_attach(this, type);id=id||dhtmlx.uid();functor = dhtmlx.toFunctor(functor);var event_stack=this._events[type]||dhtmlx.toArray();event_stack.push(functor);this._events[type]=event_stack;this._handlers[id]={f:functor,t:type };return id;},
 
 detachEvent:function(id){if(this._handlers[id]){var type=this._handlers[id].t;var functor=this._handlers[id].f;var event_stack=this._events[type];event_stack.remove(functor);delete this._handlers[id];}
 }
};dhtmlx.PowerArray={removeAt:function(pos,len){if (pos>=0)this.splice(pos,(len||1));},
 
 remove:function(value){this.removeAt(this.find(value));}, 
 
 insertAt:function(data,pos){if (!pos && pos!==0)this.push(data);else {var b = this.splice(pos,(this.length-pos));this[pos] = data;this.push.apply(this,b);}
 }, 
 
 find:function(data){for (i=0;i<this.length;i++)if (data==this[i])return i;return -1;},
 
 each:function(functor,master){for (var i=0;i < this.length;i++)functor.call((master||this),this[i]);},
 
 map:function(functor,master){for (var i=0;i < this.length;i++)this[i]=functor.call((master||this),this[i]);return this;}
};dhtmlx.env = {};if (navigator.userAgent.indexOf('Opera')!= -1)
 dhtmlx._isOpera=true;else{dhtmlx._isIE=!!document.all;dhtmlx._isFF=!document.all;dhtmlx._isWebKit=(navigator.userAgent.indexOf("KHTML")!=-1);if (navigator.appVersion.indexOf("MSIE 8.0")!= -1 && document.compatMode != "BackCompat") 
 dhtmlx._isIE=8;if (navigator.appVersion.indexOf("MSIE 9.0")!= -1 && document.compatMode != "BackCompat") 
 dhtmlx._isIE=9;}
dhtmlx.env = {};(function(){dhtmlx.env.transform = false;dhtmlx.env.transition = false;var options = {};options.names = ['transform', 'transition'];options.transform = ['transform', 'WebkitTransform', 'MozTransform', 'oTransform','msTransform'];options.transition = ['transition', 'WebkitTransition', 'MozTransition', 'oTransition'];var d = document.createElement("DIV");var property;for(var i=0;i<options.names.length;i++){while (p = options[options.names[i]].pop()) {if(typeof d.style[p] != 'undefined')dhtmlx.env[options.names[i]] = true;}
 }
})();dhtmlx.env.transform_prefix = (function(){var prefix;if(dhtmlx._isOpera)prefix = '-o-';else {prefix = '';if(dhtmlx._isFF)prefix = '-moz-';if(dhtmlx._isWebKit)prefix = '-webkit-';}
 return prefix;})();dhtmlx.env.svg = (function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");})();dhtmlx.zIndex={drag : 10000 };dhtmlx.html={create:function(name,attrs,html){attrs = attrs || {};var node = document.createElement(name);for (var attr_name in attrs)node.setAttribute(attr_name, attrs[attr_name]);if (attrs.style)node.style.cssText = attrs.style;if (attrs["class"])node.className = attrs["class"];if (html)node.innerHTML=html;return node;},
 
 getValue:function(node){node = dhtmlx.toNode(node);if (!node)return "";return dhtmlx.isNotDefined(node.value)?node.innerHTML:node.value;},
 
 remove:function(node){if (node instanceof Array)for (var i=0;i < node.length;i++)this.remove(node[i]);else
 if (node && node.parentNode)node.parentNode.removeChild(node);},
 
 insertBefore: function(node,before,rescue){if (!node)return;if (before)before.parentNode.insertBefore(node, before);else
 rescue.appendChild(node);},
 
 
 locate:function(e,id){e=e||event;var trg=e.target||e.srcElement;while (trg){if (trg.getAttribute){var test = trg.getAttribute(id);if (test)return test;}
 trg=trg.parentNode;}
 return null;},
 
 offset:function(elem) {if (elem.getBoundingClientRect){var box = elem.getBoundingClientRect();var body = document.body;var docElem = document.documentElement;var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;var clientTop = docElem.clientTop || body.clientTop || 0;var clientLeft = docElem.clientLeft || body.clientLeft || 0;var top = box.top + scrollTop - clientTop;var left = box.left + scrollLeft - clientLeft;return {y: Math.round(top), x: Math.round(left) };}else {var top=0, left=0;while(elem){top = top + parseInt(elem.offsetTop,10);left = left + parseInt(elem.offsetLeft,10);elem = elem.offsetParent;}
 return {y: top, x: left};}
 },
 
 pos:function(ev){ev = ev || event;if(ev.pageX || ev.pageY)return {x:ev.pageX, y:ev.pageY};var d = ((dhtmlx._isIE)&&(document.compatMode != "BackCompat"))?document.documentElement:document.body;return {x:ev.clientX + d.scrollLeft - d.clientLeft,
 y:ev.clientY + d.scrollTop - d.clientTop
 };},
 
 preventEvent:function(e){if (e && e.preventDefault)e.preventDefault();dhtmlx.html.stopEvent(e);},
 
 stopEvent:function(e){(e||event).cancelBubble=true;return false;},
 
 addCss:function(node,name){node.className+=" "+name;},
 
 removeCss:function(node,name){node.className=node.className.replace(RegExp(name,"g"),"");}
};(function(){var temp = document.getElementsByTagName("SCRIPT");dhtmlx.assert(temp.length,"Can't locate codebase");if (temp.length){temp = (temp[temp.length-1].getAttribute("src")||"").split("/");temp.splice(temp.length-1, 1);dhtmlx.codebase = temp.slice(0, temp.length).join("/")+"/";}
})();if (!dhtmlx.ui)dhtmlx.ui={};dhtmlx.Template={_cache:{},
 empty:function(){return "";},
 setter:function(value){return dhtmlx.Template.fromHTML(value);},
 obj_setter:function(value){var f = dhtmlx.Template.setter(value);var obj = this;return function(){return f.apply(obj, arguments);};},
 fromHTML:function(str){if (typeof str == "function")return str;if (this._cache[str])return this._cache[str];str=(str||"").toString();str=str.replace(/[\r\n]+/g,"\\n");str=str.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,"\"+(obj.$1?\"$2\":\"$3\")+\"");str=str.replace(/\{common\.([^}\(]*)\}/g,"\"+common.$1+\"");str=str.replace(/\{common\.([^\}\(]*)\(\)\}/g,"\"+(common.$1?common.$1(obj):\"\")+\"");str=str.replace(/\{obj\.([^}]*)\}/g,"\"+obj.$1+\"");str=str.replace(/#([a-z0-9_]+)#/gi,"\"+obj.$1+\"");str=str.replace(/\{obj\}/g,"\"+obj+\"");str=str.replace(/\{-obj/g,"{obj");str=str.replace(/\{-common/g,"{common");str="return \""+str+"\";";return this._cache[str]= Function("obj","common",str);}
};dhtmlx.Type={add:function(obj, data){if (!obj.types && obj.prototype.types)obj = obj.prototype;if (dhtmlx.assert_enabled())
 this.assert_event(data);var name = data.name||"default";this._template(data);this._template(data,"edit");this._template(data,"loading");obj.types[name]=dhtmlx.extend(dhtmlx.extend({},(obj.types[name]||this._default)),data);return name;},
 
 _default:{css:"default",
 template:function(){return "";},
 template_edit:function(){return "";},
 template_loading:function(){return "...";},
 width:150,
 height:80,
 margin:5,
 padding:0
 },
 
 _template:function(obj,name){name = "template"+(name?("_"+name):"");var data = obj[name];if (data && (typeof data == "string")){if (data.indexOf("->")!=-1){data = data.split("->");switch(data[0]){case "html": 
 data = dhtmlx.html.getValue(data[1]).replace(/\"/g,"\\\"");break;case "http": 
 data = new dhtmlx.ajax().sync().get(data[1],{uid:(new Date()).valueOf()}).responseText;break;default:
 
 break;}
 }
 obj[name] = dhtmlx.Template.fromHTML(data);}
 }
};dhtmlx.Settings={_init:function(){this._settings = this.config= {};},
 define:function(property, value){if (typeof property == "object")return this._parseSeetingColl(property);return this._define(property, value);},
 _define:function(property,value){dhtmlx.assert_settings.call(this,property,value);var setter = this[property+"_setter"];return this._settings[property]=setter?setter.call(this,value):value;},
 
 _parseSeetingColl:function(coll){if (coll){for (var a in coll)this._define(a,coll[a]);}
 },
 
 _parseSettings:function(obj,initial){var settings = dhtmlx.extend({},initial);if (typeof obj == "object" && !obj.tagName)dhtmlx.extend(settings,obj);this._parseSeetingColl(settings);},
 _mergeSettings:function(config, defaults){for (var key in defaults)switch(typeof config[key]){case "object": 
 config[key] = this._mergeSettings((config[key]||{}), defaults[key]);break;case "undefined":
 config[key] = defaults[key];break;default: 
 break;}
 return config;},
 
 _parseContainer:function(obj,name,fallback){if (typeof obj == "object" && !obj.tagName)obj=obj.container;this._obj = dhtmlx.toNode(obj);if (!this._obj && fallback)this._obj = fallback(obj);dhtmlx.assert(this._obj, "Incorrect html container");this._obj.className+=" "+name;this._obj.onselectstart=function(){return false;};this._dataobj = this._obj;},
 
 _set_type:function(name){if (typeof name == "object")return this.type_setter(name);dhtmlx.assert(this.types, "RenderStack :: Types are not defined");dhtmlx.assert(this.types[name],"RenderStack :: Inccorect type name",name);this.type=dhtmlx.extend({},this.types[name]);this.customize();},
 customize:function(obj){if (obj)dhtmlx.extend(this.type,obj);this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type));this.type._item_end = this.template_item_end(this.type);this.render();},
 
 type_setter:function(value){this._set_type(typeof value == "object"?dhtmlx.Type.add(this,value):value);return value;},
 
 template_setter:function(value){return this.type_setter({template:value});},
 
 css_setter:function(value){this._obj.className += " "+value;return value;}
};dhtmlx.Destruction = {_init:function(){dhtmlx.destructors.push(this);},
 
 
 destructor:function(){this.destructor=function(){};this._htmlmap = null;this._htmlrows = null;if (this._html)document.body.appendChild(this._html);this._html = null;if (this._obj){this._obj.innerHTML="";this._obj._htmlmap = null;}
 this._obj = this._dataobj=null;this.data = null;this._events = this._handlers = {};}
};dhtmlx.destructors = [];dhtmlx.event(window,"unload",function(){for (var i=0;i<dhtmlx.destructors.length;i++)dhtmlx.destructors[i].destructor();dhtmlx.destructors = [];for (var a in dhtmlx._events){var ev = dhtmlx._events[a];if (ev[0].removeEventListener)ev[0].removeEventListener(ev[1],ev[2],false);else if (ev[0].detachEvent)ev[0].detachEvent("on"+ev[1],ev[2]);delete dhtmlx._events[a];}
});dhtmlx.ui.pager=function(container){this.name = "Pager";if (dhtmlx.assert_enabled()) this._assert();dhtmlx.extend(this, dhtmlx.Settings);this._parseContainer(container,"dhx_pager");dhtmlx.extend(this, dhtmlx.EventSystem);dhtmlx.extend(this, dhtmlx.SingleRender);dhtmlx.extend(this, dhtmlx.MouseEvents);this._parseSettings(container,{size:10, 
 page:-1, 
 group:5, 
 count:0, 
 type:"default"
 });this.data = this._settings;this.refresh();};dhtmlx.ui.pager.prototype={_id:"dhx_p_id",
 on_click:{"dhx_pager_item":function(e,id){this.select(id);}
 },
 select:function(id){switch(id){case "next":
 id = this._settings.page+1;break;case "prev":
 id = this._settings.page-1;break;case "first":
 id = 0;break;case "last":
 id = this._settings.limit-1;break;default:
 
 break;}
 if (id<0)id=0;if (id>=this.data.limit)id=this.data.limit-1;if (this.callEvent("onBeforePageChange",[this._settings.page,id])){this.data.page = id*1;this.refresh();this.callEvent("onAfterPageChange",[id]);}
 },
 types:{"default":{template:dhtmlx.Template.fromHTML("{common.pages()}"),
 
 pages:function(obj){var html="";if (obj.page == -1)return "";obj.min = obj.page-Math.round((obj.group-1)/2);obj.max = obj.min + obj.group-1;if (obj.min<0){obj.max+=obj.min*(-1);obj.min=0;}
 if (obj.max>=obj.limit){obj.min -= Math.min(obj.min,obj.max-obj.limit+1);obj.max = obj.limit-1;}
 
 for (var i=(obj.min||0);i<=obj.max;i++)
 html+=this.button({id:i, index:(i+1), selected:(i == obj.page ?"_selected":"")});return html;},
 page:function(obj){return obj.page+1;},
 
 first:function(){return this.button({id:"first", index:" &lt;&lt;", selected:""});},
 
 last:function(){return this.button({id:"last", index:" &gt;&gt;", selected:""});},
 
 prev:function(){return this.button({id:"prev", index:"&lt;", selected:""});},
 
 next:function(){return this.button({id:"next", index:"&gt;", selected:""});},
 button:dhtmlx.Template.fromHTML("<div dhx_p_id='{obj.id}' class='dhx_pager_item{obj.selected}'>{obj.index}</div>")
 
 }
 },
 
 refresh:function(){var s = this._settings;s.limit = Math.ceil(s.count/s.size);if (s.limit && s.limit != s.old_limit)s.page = Math.min(s.limit-1, s.page);var id = s.page;if (id!=-1 && (id!=s.old_page)|| (s.limit != s.old_limit)){this.render();this.callEvent("onRefresh",[]);s.old_limit = s.limit;s.old_page = s.page;}
 },
 template_item_start:dhtmlx.Template.fromHTML("<div>"),
 template_item_end:dhtmlx.Template.fromHTML("</div>")
};dhtmlx.SingleRender={_init:function(){},
 
 _toHTML:function(obj){return this.type._item_start(obj,this.type)+this.type.template(obj,this.type)+this.type._item_end;},
 
 render:function(){if (!this.callEvent || this.callEvent("onBeforeRender",[this.data])){if (this.data)this._dataobj.innerHTML = this._toHTML(this.data);if (this.callEvent)this.callEvent("onAfterRender",[]);}
 }
};dhtmlx.ui.Tooltip=function(container){this.name = "Tooltip";this.version = "3.0";if (dhtmlx.assert_enabled()) this._assert();if (typeof container == "string"){container = {template:container };}
 
 dhtmlx.extend(this, dhtmlx.Settings);dhtmlx.extend(this, dhtmlx.SingleRender);this._parseSettings(container,{type:"default",
 dy:0,
 dx:20
 });this._dataobj = this._obj = document.createElement("DIV");this._obj.className="dhx_tooltip";dhtmlx.html.insertBefore(this._obj,document.body.firstChild);};dhtmlx.ui.Tooltip.prototype = {show:function(data,pos){if (this._disabled)return;if (this.data!=data){this.data=data;this.render(data);}
 
 this._obj.style.top = pos.y+this._settings.dy+"px";this._obj.style.left = pos.x+this._settings.dx+"px";this._obj.style.display="block";},
 
 hide:function(){this.data=null;this._obj.style.display="none";},
 disable:function(){this._disabled = true;},
 enable:function(){this._disabled = false;},
 types:{"default":dhtmlx.Template.fromHTML("{obj.id}")
 },
 template_item_start:dhtmlx.Template.empty,
 template_item_end:dhtmlx.Template.empty
};dhtmlx.AutoTooltip = {tooltip_setter:function(value){var t = new dhtmlx.ui.Tooltip(value);this.attachEvent("onMouseMove",function(id,e){t.show(this.get(id),dhtmlx.html.pos(e));});this.attachEvent("onMouseOut",function(id,e){t.hide();});this.attachEvent("onMouseMoving",function(id,e){t.hide();});return t;}
};dhtmlx.compat=function(name, obj){if (dhtmlx.compat[name])dhtmlx.compat[name](obj);};(function(){if (!window.dhtmlxError){var dummy = function(){};window.dhtmlxError={catchError:dummy, throwError:dummy };window.convertStringToBoolean=function(value){return !!value;};window.dhtmlxEventable = function(node){dhtmlx.extend(node,dhtmlx.EventSystem);};var loader = {getXMLTopNode:function(name){},
 doXPath:function(path){return dhtmlx.DataDriver.xml.xpath(this.xml,path);},
 xmlDoc:{responseXML:true
 }
 };dhtmlx.compat.dataProcessor=function(obj){var sendData = "_sendData";var in_progress = "_in_progress";var tMode = "_tMode";var waitMode = "_waitMode";obj[sendData]=function(a1,rowId){if (!a1)return;if (rowId)this[in_progress][rowId]=(new Date()).valueOf();if (!this.callEvent("onBeforeDataSending",rowId?[rowId,this.getState(rowId)]:[])) return false;var a2 = this;var a3=this.serverProcessor;if (this[tMode]!="POST")dhtmlx.ajax().get(a3+((a3.indexOf("?")!=-1)?"&":"?")+this.serialize(a1,rowId),"",function(t,x,xml){loader.xml = dhtmlx.DataDriver.xml.checkResponse(t,x);a2.afterUpdate(a2, null, null, null, loader);});else
 dhtmlx.ajax().post(a3,this.serialize(a1,rowId),function(t,x,xml){loader.xml = dhtmlx.DataDriver.xml.checkResponse(t,x);a2.afterUpdate(a2, null, null, null, loader);});this[waitMode]++;};};}
 
})();dhtmlx.DataProcessor={_dp_init:function(dp){var varname = "_methods";dp[varname]=["setItemStyle","","changeId","remove"];this.attachEvent("onAfterAdd",function(id){dp.setUpdated(id,true,"inserted");});this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(driver, data){if (driver.getUserData)driver.getUserData(data,this._userdata);},this));this.attachEvent("onBeforeDelete",function(id){var z=dp.getState(id);if (z=="inserted"){dp.setUpdated(id,false);return true;}
 if (z=="deleted")return false;if (z=="true_deleted")return true;dp.setUpdated(id,true,"deleted");return false;});this.attachEvent("onAfterEditStop",function(id){dp.setUpdated(id,true,"updated");});this.attachEvent("onBindUpdate",function(data){window.setTimeout(function(){dp.setUpdated(data.id,true,"updated");},1);});varname = "_getRowData";dp[varname]=function(id,pref){var ev=this.obj.data.get(id);var data = {};for (var a in ev){if (a.indexOf("_")===0) continue;data[a]=ev[a];}
 
 return data;};varname = "_clearUpdateFlag";dp[varname]=function(){};this._userdata = {};dp.attachEvent("insertCallback", this._dp_callback);dp.attachEvent("updateCallback", this._dp_callback);dp.attachEvent("deleteCallback", function(upd, id) {this.obj.setUserData(id, this.action_param, "true_deleted");this.obj.remove(id);});dhtmlx.compat("dataProcessor",dp);},
 _dp_callback:function(upd,id){this.obj.data.set(id,dhtmlx.DataDriver.xml.getDetails(upd.firstChild));this.obj.data.refresh(id);},
 
 setItemStyle:function(id,style){var node = this._locateHTML(id);if (node)node.style.cssText+=";"+style;},
 
 changeId:function(oldid, newid){this.data.changeId(oldid, newid);this.refresh();},
 
 setUserData:function(id,name,value){if (id)this.data.get(id)[name]=value;else
 this._userdata[name]=value;},
 
 getUserData:function(id,name){return id?this.data.get(id)[name]:this._userdata[name];}
};(function(){var temp = "_dp_init";dhtmlx.DataProcessor[temp]=dhtmlx.DataProcessor._dp_init;})();dhtmlx.compat.dnd = function(){if (window.dhtmlDragAndDropObject){var _dragged = "_dragged";var old_ocl = dhtmlDragAndDropObject.prototype.checkLanding;dhtmlDragAndDropObject.prototype.checkLanding=function(node,e,skip){old_ocl.apply(this,arguments);if (!skip){var c = dhtmlx.DragControl._drag_context = dhtmlx.DragControl._drag_context||{};if (!c.from)c.from = this.dragStartObject;dhtmlx.DragControl._checkLand(node,e,true);}
 };var old_odp = dhtmlDragAndDropObject.prototype.stopDrag;dhtmlDragAndDropObject.prototype.stopDrag=function(e,dot,skip){if (!skip){if (dhtmlx.DragControl._last){dhtmlx.DragControl._active = dragger.dragStartNode;dhtmlx.DragControl._stopDrag(e,true);}
 }
 old_odp.apply(this,arguments);};var dragger = new dhtmlDragAndDropObject();var old_start = dhtmlx.DragControl._startDrag;dhtmlx.DragControl._startDrag=function(){old_start.apply(this,arguments);var c = dhtmlx.DragControl._drag_context;if (!c)return;var source = [];var tsource = [];for (var i=0;i < c.source.length;i++){source[i]={idd:c.source[i]};tsource.push(c.source[i]);}
 
 dragger.dragStartNode = {parentNode:{}, 
 parentObject:{idd:source, 
 id:(tsource.length == 1?tsource[0]:tsource),
 treeNod:{object:c.from
 }
 }
 };dragger.dragStartNode.parentObject.treeNod[_dragged]=source;dragger.dragStartObject = c.from;};var old_check = dhtmlx.DragControl._checkLand;dhtmlx.DragControl._checkLand = function(node,e,skip){old_check.apply(this,arguments);if (!this._last && !skip){node = dragger.checkLanding(node,e,true);}
 };var old_drop = dhtmlx.DragControl._stopDrag;dhtmlx.DragControl._stopDrag=function(e,skip){old_drop.apply(this,arguments);if (dragger.lastLanding && !skip)dragger.stopDrag(e,false,true);};var old_mst = dhtmlx.DragControl.getMaster;dhtmlx.DragControl.getMaster = function(t){var master = null;if (t)master = old_mst.apply(this,arguments);if (!master){master = dragger.dragStartObject;var src = [];var from = master[_dragged];for (var i=0;i < from.length;i++){src.push(from[i].idd||from[i].id);}
 dhtmlx.DragControl._drag_context.source = src;}
 return master;};}
};dhtmlx.DataMove={_init:function(){dhtmlx.assert(this.data, "DataMove :: Component doesn't have DataStore");},
 
 copy:function(sid,tindex,tobj,tid){var data = this.get(sid);if (!data){dhtmlx.log("Warning","Incorrect ID in DataMove::copy");return;}
 
 
 if (tobj){dhtmlx.assert(tobj.externalData,"DataMove :: External object doesn't support operation");data = tobj.externalData(data);}
 tobj = tobj||this;return tobj.add(tobj.externalData(data,tid),tindex);},
 
 move:function(sid,tindex,tobj,tid){if (sid instanceof Array){for (var i=0;i < sid.length;i++){var new_index = (tobj||this).indexById(this.move(sid[i], tindex, tobj, dhtmlx.uid()));if (sid[i+1])tindex = new_index+(this.indexById(sid[i+1])<new_index?0:1);}
 return;}
 
 nid = sid;if (tindex<0){dhtmlx.log("Info","DataMove::move - moving outside of bounds is ignored");return;}
 
 var data = this.get(sid);if (!data){dhtmlx.log("Warning","Incorrect ID in DataMove::move");return;}
 
 if (!tobj || tobj == this)this.data.move(this.indexById(sid),tindex);else {dhtmlx.assert(tobj.externalData, "DataMove :: External object doesn't support operation");nid=tobj.add(tobj.externalData(data,tid),tindex);this.remove(sid);}
 return nid;},
 
 moveUp:function(id,step){return this.move(id,this.indexById(id)-(step||1));},
 
 moveDown:function(id,step){return this.moveUp(id, (step||1)*-1);},
 
 moveTop:function(id){return this.move(id,0);},
 
 moveBottom:function(id){return this.move(id,this.data.dataCount()-1);},
 
 externalData:function(data,id){var newdata = dhtmlx.extend({},data);newdata.id = id||dhtmlx.uid();newdata.$selected=newdata.$template=null;return newdata;}
};dhtmlx.DragControl={_drag_masters : dhtmlx.toArray(["dummy"]),
 
 addDrop:function(node,ctrl,master_mode){node = dhtmlx.toNode(node);node.dhx_drop=this._getCtrl(ctrl);if (master_mode)node.dhx_master=true;},
 
 
 
 _getCtrl:function(ctrl){ctrl = ctrl||dhtmlx.DragControl;var index = this._drag_masters.find(ctrl);if (index<0){index = this._drag_masters.length;this._drag_masters.push(ctrl);}
 return index;},
 
 addDrag:function(node,ctrl){node = dhtmlx.toNode(node);node.dhx_drag=this._getCtrl(ctrl);dhtmlx.event(node,"mousedown",this._preStart,node);},
 
 _preStart:function(e){if (dhtmlx.DragControl._active){dhtmlx.DragControl._preStartFalse();dhtmlx.DragControl.destroyDrag();}
 dhtmlx.DragControl._active=this;dhtmlx.DragControl._start_pos={x:e.pageX, y:e.pageY};dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body,"mousemove",dhtmlx.DragControl._startDrag);dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body,"mouseup",dhtmlx.DragControl._preStartFalse);dhtmlx.DragControl._dhx_drag_sc = dhtmlx.event(this,"scroll",dhtmlx.DragControl._preStartFalse);e.cancelBubble=true;return false;},
 
 _preStartFalse:function(e){dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);dhtmlx.DragControl._dhx_drag_sc = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_sc);},
 
 _startDrag:function(e){var pos = {x:e.pageX, y:e.pageY};if (Math.abs(pos.x-dhtmlx.DragControl._start_pos.x)<5 && Math.abs(pos.y-dhtmlx.DragControl._start_pos.y)<5)
 return;dhtmlx.DragControl._preStartFalse();if (!dhtmlx.DragControl.createDrag(e)) return;dhtmlx.DragControl.sendSignal("start");dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body,"mousemove",dhtmlx.DragControl._moveDrag);dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body,"mouseup",dhtmlx.DragControl._stopDrag);dhtmlx.DragControl._moveDrag(e);},
 
 _stopDrag:function(e){dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);if (dhtmlx.DragControl._last){dhtmlx.DragControl.onDrop(dhtmlx.DragControl._active,dhtmlx.DragControl._last,this._landing,e);dhtmlx.DragControl.onDragOut(dhtmlx.DragControl._active,dhtmlx.DragControl._last,null,e);}
 dhtmlx.DragControl.destroyDrag();dhtmlx.DragControl.sendSignal("stop");},
 
 _moveDrag:function(e){var pos = dhtmlx.html.pos(e);dhtmlx.DragControl._html.style.top=pos.y+dhtmlx.DragControl.top +"px";dhtmlx.DragControl._html.style.left=pos.x+dhtmlx.DragControl.left+"px";if (dhtmlx.DragControl._skip)dhtmlx.DragControl._skip=false;else
 dhtmlx.DragControl._checkLand((e.srcElement||e.target),e);e.cancelBubble=true;return false;},
 
 _checkLand:function(node,e){while (node && node.tagName!="BODY"){if (node.dhx_drop){if (this._last && (this._last!=node || node.dhx_master)) 
 this.onDragOut(this._active,this._last,node,e);if (!this._last || this._last!=node || node.dhx_master){this._last=null;this._landing=this.onDragIn(dhtmlx.DragControl._active,node,e);if (this._landing)this._last=node;return;}
 return;}
 node=node.parentNode;}
 if (this._last)this._last = this._landing = this.onDragOut(this._active,this._last,null,e);},
 
 sendSignal:function(signal){dhtmlx.DragControl.active=(signal=="start");},
 
 
 getMaster:function(t){return this._drag_masters[t.dhx_drag||t.dhx_drop];},
 
 getContext:function(t){return this._drag_context;},
 
 createDrag:function(e){var a=dhtmlx.DragControl._active;var master = this._drag_masters[a.dhx_drag];var drag_container;if (master.onDragCreate){drag_container=master.onDragCreate(a,e);drag_container.style.position='absolute';drag_container.style.zIndex=dhtmlx.zIndex.drag;drag_container.onmousemove=dhtmlx.DragControl._skip_mark;}else {var text = dhtmlx.DragControl.onDrag(a,e);if (!text)return false;var drag_container = document.createElement("DIV");drag_container.innerHTML=text;drag_container.className="dhx_drag_zone";drag_container.onmousemove=dhtmlx.DragControl._skip_mark;document.body.appendChild(drag_container);}
 dhtmlx.DragControl._html=drag_container;return true;},
 
 _skip_mark:function(){dhtmlx.DragControl._skip=true;},
 
 destroyDrag:function(){var a=dhtmlx.DragControl._active;var master = this._drag_masters[a.dhx_drag];if (master && master.onDragDestroy)master.onDragDestroy(a,dhtmlx.DragControl._html);else dhtmlx.html.remove(dhtmlx.DragControl._html);dhtmlx.DragControl._landing=dhtmlx.DragControl._active=dhtmlx.DragControl._last=dhtmlx.DragControl._html=null;},
 top:5, 
 left:5,
 
 onDragIn:function(s,t,e){var m=this._drag_masters[t.dhx_drop];if (m.onDragIn && m!=this)return m.onDragIn(s,t,e);t.className=t.className+" dhx_drop_zone";return t;},
 
 onDragOut:function(s,t,n,e){var m=this._drag_masters[t.dhx_drop];if (m.onDragOut && m!=this)return m.onDragOut(s,t,n,e);t.className=t.className.replace("dhx_drop_zone","");return null;},
 
 onDrop:function(s,t,d,e){var m=this._drag_masters[t.dhx_drop];dhtmlx.DragControl._drag_context.from = dhtmlx.DragControl.getMaster(s);if (m.onDrop && m!=this)return m.onDrop(s,t,d,e);t.appendChild(s);},
 
 onDrag:function(s,e){var m=this._drag_masters[s.dhx_drag];if (m.onDrag && m!=this)return m.onDrag(s,e);dhtmlx.DragControl._drag_context = {source:s, from:s};return "<div style='"+s.style.cssText+"'>"+s.innerHTML+"</div>";}
};dhtmlx.DragItem={_init:function(){dhtmlx.assert(this.move,"DragItem :: Component doesn't have DataMove interface");dhtmlx.assert(this.locate,"DragItem :: Component doesn't have RenderStack interface");dhtmlx.assert(dhtmlx.DragControl,"DragItem :: DragControl is not included");if (!this._settings || this._settings.drag)dhtmlx.DragItem._initHandlers(this);else if (this._settings){this.drag_setter=function(value){if (value){this._initHandlers(this);delete this.drag_setter;}
 return value;};}
 
 if (this.dragMarker){this.attachEvent("onBeforeDragIn",this.dragMarker);this.attachEvent("onDragOut",this.dragMarker);}
 
 },
 
 _initHandlers:function(obj){dhtmlx.DragControl.addDrop(obj._obj,obj,true);dhtmlx.DragControl.addDrag(obj._obj,obj);},
 
 
 onDragIn:function(s,t,e){var id = this.locate(e) || null;var context = dhtmlx.DragControl._drag_context;var to = dhtmlx.DragControl.getMaster(s);var html = (this._locateHTML(id)||this._obj);if (html == dhtmlx.DragControl._landing)return html;context.target = id;context.to = to;if (!this.callEvent("onBeforeDragIn",[context,e])){context.id = null;return null;}
 
 dhtmlx.html.addCss(html,"dhx_drag_over");return html;},
 
 onDragOut:function(s,t,n,e){var id = this.locate(e) || null;if (n != this._dataobj)id = null;var html = (this._locateHTML(id)||(n?dhtmlx.DragControl.getMaster(n)._obj:window.undefined));if (html == dhtmlx.DragControl._landing)return null;var context = dhtmlx.DragControl._drag_context;dhtmlx.html.removeCss(dhtmlx.DragControl._landing,"dhx_drag_over");context.target = context.to = null;this.callEvent("onDragOut",[context,e]);return null;},
 
 onDrop:function(s,t,d,e){var context = dhtmlx.DragControl._drag_context;context.to = this;context.index = context.target?this.indexById(context.target):this.dataCount();context.new_id = dhtmlx.uid();if (!this.callEvent("onBeforeDrop",[context,e])) return;if (context.from==context.to){this.move(context.source,context.index);}else {if (context.from)context.from.move(context.source,context.index,context.to,context.new_id);else
 dhtmlx.error("Unsopported d-n-d combination");}
 this.callEvent("onAfterDrop",[context,e]);},
 
 onDrag:function(s,e){var id = this.locate(e);var list = [id];if (id){if (this.getSelected){var selection = this.getSelected();if (dhtmlx.PowerArray.find.call(selection,id)!=-1)
 list = selection;}
 
 var context = dhtmlx.DragControl._drag_context= {source:list, start:id };context.from = this;if (this.callEvent("onBeforeDrag",[context,e]))
 return context.html||this._toHTML(this.get(id));}
 return null;}
 
 
};dhtmlx.EditAbility={_init: function(id){this._edit_id = null;this._edit_bind = null;dhtmlx.assert(this.data,"EditAbility :: Component doesn't have DataStore");dhtmlx.assert(this._locateHTML,"EditAbility :: Component doesn't have RenderStack");this.attachEvent("onEditKeyPress",function(code, ctrl, shift){if (code == 13 && !shift)this.stopEdit();else if (code == 27)this.stopEdit(true);});this.attachEvent("onBeforeRender", function(){this.stopEdit();});},
 
 isEdit:function(){return this._edit_id;},
 
 edit:function(id){if (this.stopEdit(false, id)){if (!this.callEvent("onBeforeEditStart",[id])) 
 return;var data = this.data.get(id);if (data.$template)return;data.$template="edit";this.data.refresh(id);this._edit_id = id;this._save_binding(id);this._edit_bind(true,data);this.callEvent("onAfterEditStart",[id]);}
 },
 
 stopEdit:function(mode, if_not_id){if (!this._edit_id)return true;if (this._edit_id == if_not_id)return false;var values = {};if (!mode)this._edit_bind(false,values);else values = null;if (!this.callEvent("onBeforeEditStop",[this._edit_id, values]))
 return false;var data=this.data.get(this._edit_id);data.$template=null;if (!mode)this._edit_bind(false,data);var id = this._edit_id;this._edit_bind=this._edit_id=null;this.data.refresh(id);this.callEvent("onAfterEditStop",[id, values]);return true;},
 
 _save_binding:function(id){var cont = this._locateHTML(id);var code = "";var back_code = "";var bind_elements = [];if (cont){var elements = cont.getElementsByTagName("*");var bind = "";for (var i=0;i < elements.length;i++){if(elements[i].nodeType==1 && (bind = elements[i].getAttribute("bind"))){code+="els["+bind_elements.length+"].value="+bind+";";back_code+=bind+"=els["+bind_elements.length+"].value;";bind_elements.push(elements[i]);elements[i].className+=" dhx_allow_selection";elements[i].onselectstart=this._block_native;}
 }
 elements = null;}
 
 code = Function("obj","els",code);back_code = Function("obj","els",back_code);this._edit_bind = function(mode,obj){if (mode){code(obj,bind_elements);if (bind_elements.length && bind_elements[0].select)bind_elements[0].select();}
 else 
 back_code(obj,bind_elements);};},
 
 _block_native:function(e){(e||event).cancelBubble=true;return true;}
};dhtmlx.KeyEvents = {_init:function(){dhtmlx.event(this._obj,"keypress",this._onKeyPress,this);},
 
 _onKeyPress:function(e){e=e||event;var code = e.which||e.keyCode;this.callEvent((this._edit_id?"onEditKeyPress":"onKeyPress"),[code,e.ctrlKey,e.shiftKey,e]);}
};dhtmlx.MouseEvents={_init: function(){if (this.on_click){dhtmlx.event(this._obj,"click",this._onClick,this);dhtmlx.event(this._obj,"contextmenu",this._onContext,this);}
 if (this.on_dblclick)dhtmlx.event(this._obj,"dblclick",this._onDblClick,this);if (this.on_mouse_move){dhtmlx.event(this._obj,"mousemove",this._onMouse,this);dhtmlx.event(this._obj,(dhtmlx._isIE?"mouseleave":"mouseout"),this._onMouse,this);}
 },
 
 _onClick: function(e) {return this._mouseEvent(e,this.on_click,"ItemClick");},
 
 _onDblClick: function(e) {return this._mouseEvent(e,this.on_dblclick,"ItemDblClick");},
 
 _onContext: function(e) {var id = dhtmlx.html.locate(e, this._id);if (id && !this.callEvent("onBeforeContextMenu", [id,e]))
 return dhtmlx.html.preventEvent(e);},
 
 _onMouse:function(e){if (dhtmlx._isIE)e = document.createEventObject(event);if (this._mouse_move_timer)window.clearTimeout(this._mouse_move_timer);this.callEvent("onMouseMoving",[e]);this._mouse_move_timer = window.setTimeout(dhtmlx.bind(function(){if (e.type == "mousemove")this._onMouseMove(e);else
 this._onMouseOut(e);},this),500);},
 
 _onMouseMove: function(e) {if (!this._mouseEvent(e,this.on_mouse_move,"MouseMove"))
 this.callEvent("onMouseOut",[e||event]);},
 
 _onMouseOut: function(e) {this.callEvent("onMouseOut",[e||event]);},
 
 _mouseEvent:function(e,hash,name){e=e||event;var trg=e.target||e.srcElement;var css = "";var id = null;var found = false;while (trg && trg.parentNode){if (!found && trg.getAttribute){id = trg.getAttribute(this._id);if (id){if (trg.getAttribute("userdata"))
 this.callEvent("onLocateData",[id,trg]);if (!this.callEvent("on"+name,[id,e,trg])) return;found = true;}
 }
 css=trg.className;if (css){css = css.split(" ");css = css[0]||css[1];if (hash[css])return hash[css].call(this,e,id||dhx.html.locate(e, this._id),trg);}
 trg=trg.parentNode;}
 return found;}
};dhtmlx.SelectionModel={_init:function(){this._selected = dhtmlx.toArray();dhtmlx.assert(this.data, "SelectionModel :: Component doesn't have DataStore");this.data.attachEvent("onStoreUpdated",dhtmlx.bind(this._data_updated,this));this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._data_loaded,this));this.data.attachEvent("onAfterFilter", dhtmlx.bind(this._data_filtered,this));this.data.attachEvent("onIdChange", dhtmlx.bind(this._id_changed,this));},
 _id_changed:function(oldid, newid){for (var i = this._selected.length - 1;i >= 0;i--)if (this._selected[i]==oldid)this._selected[i]=newid;},
 _data_filtered:function(){for (var i = this._selected.length - 1;i >= 0;i--){if (this.data.indexById(this._selected[i])< 0)
 var id = this._selected[i];var item = this.item(id);if (item)delete item.$selected;this._selected.splice(i,1);this.callEvent("onSelectChange",[id]);}
 },
 
 _data_updated:function(id,obj,type){if (type == "delete")this._selected.remove(id);else if (!this.data.dataCount()&& !this.data._filter_order){this._selected = dhtmlx.toArray();}
 },
 _data_loaded:function(){if (this._settings.select)this.data.each(function(obj){if (obj.$selected)this.select(obj.id);}, this);},
 
 _select_mark:function(id,state,refresh){if (!refresh && !this.callEvent("onBeforeSelect",[id,state])) return false;this.data.item(id).$selected=state;if (refresh)refresh.push(id);else{if (state)this._selected.push(id);else
 this._selected.remove(id);this._refresh_selection(id);}
 
 return true;},
 
 select:function(id,non_modal,continue_old){if (!id)return this.selectAll();if (id instanceof Array){for (var i=0;i < id.length;i++)this.select(id[i], non_modal, continue_old);return;}
 if (!this.data.exists(id)){dhtmlx.error("Incorrect id in select command: "+id);return;}
 
 
 if (continue_old && this._selected.length)return this.selectAll(this._selected[this._selected.length-1],id);if (!non_modal && (this._selected.length!=1 || this._selected[0]!=id)){this._silent_selection = true;this.unselectAll();this._silent_selection = false;}
 if (this.isSelected(id)){if (non_modal)this.unselect(id);return;}
 
 if (this._select_mark(id,true)){this.callEvent("onAfterSelect",[id]);}
 },
 
 unselect:function(id){if (!id)return this.unselectAll();if (!this.isSelected(id)) return;this._select_mark(id,false);},
 
 selectAll:function(from,to){var range;var refresh=[];if (from||to)range = this.data.getRange(from||null,to||null);else
 range = this.data.getRange();range.each(function(obj){var d = this.data.item(obj.id);if (!d.$selected){this._selected.push(obj.id);this._select_mark(obj.id,true,refresh);}
 return obj.id;},this);this._refresh_selection(refresh);},
 
 unselectAll:function(){var refresh=[];this._selected.each(function(id){this._select_mark(id,false,refresh);},this);this._selected=dhtmlx.toArray();this._refresh_selection(refresh);},
 
 isSelected:function(id){return this._selected.find(id)!=-1;},
 
 getSelected:function(as_array){switch(this._selected.length){case 0: return as_array?[]:"";case 1: return as_array?[this._selected[0]]:this._selected[0];default: return ([].concat(this._selected));}
 },
 
 _is_mass_selection:function(obj){return obj.length>100 || obj.length > this.data.dataCount/2;},
 _refresh_selection:function(refresh){if (typeof refresh != "object")refresh = [refresh];if (!refresh.length)return;if (this._is_mass_selection(refresh)) 
 this.data.refresh();else
 for (var i=0;i < refresh.length;i++)this.render(refresh[i],this.data.item(refresh[i]),"update");if (!this._silent_selection)this.callEvent("onSelectChange",[refresh]);}
};dhtmlx.RenderStack={_init:function(){dhtmlx.assert(this.data,"RenderStack :: Component doesn't have DataStore");dhtmlx.assert(dhtmlx.Template,"dhtmlx.Template :: dhtmlx.Template is not accessible");this._html = document.createElement("DIV");},
 
 _toHTML:function(obj){dhtmlx.assert((!obj.$template || this.type["template_"+obj.$template]),"RenderStack :: Unknown template: "+obj.$template);this.callEvent("onItemRender",[obj]);return this.type._item_start(obj,this.type)+(obj.$template?this.type["template_"+obj.$template]:this.type.template)(obj,this.type)+this.type._item_end;},
 
 _toHTMLObject:function(obj){this._html.innerHTML = this._toHTML(obj);return this._html.firstChild;},
 
 
 _locateHTML:function(search_id){if (this._htmlmap)return this._htmlmap[search_id];this._htmlmap={};var t = this._dataobj.childNodes;for (var i=0;i < t.length;i++){var id = t[i].getAttribute(this._id);if (id)this._htmlmap[id]=t[i];}
 
 return this._locateHTML(search_id);},
 
 locate:function(e){return dhtmlx.html.locate(e,this._id);},
 
 show:function(id){var html = this._locateHTML(id);if (html)this._dataobj.scrollTop = html.offsetTop-this._dataobj.offsetTop;},
 
 
 
 render:function(id,data,type,after){if (id){var cont = this._locateHTML(id);switch(type){case "update":
 
 if (!cont)return;var t = this._htmlmap[id] = this._toHTMLObject(data);dhtmlx.html.insertBefore(t, cont);dhtmlx.html.remove(cont);break;case "delete":
 
 if (!cont)return;dhtmlx.html.remove(cont);delete this._htmlmap[id];break;case "add":
 
 var t = this._htmlmap[id] = this._toHTMLObject(data);dhtmlx.html.insertBefore(t, this._locateHTML(this.data.next(id)), this._dataobj);break;case "move":
 
 
 this.render(id,data,"delete");this.render(id,data,"add");break;default:
 dhtmlx.error("Unknown render command: "+type);break;}
 }else {if (this.callEvent("onBeforeRender",[this.data])){this._dataobj.innerHTML = this.data.getRange().map(this._toHTML,this).join("");this._htmlmap = null;}
 }
 this.callEvent("onAfterRender",[]);},
 
 
 pager_setter:function(value){this.attachEvent("onBeforeRender",function(){var s = this._settings.pager._settings;if (s.page == -1)return false;this.data.min = s.page*s.size;this.data.max = (s.page+1)*s.size-1;return true;});var pager = new dhtmlx.ui.pager(value);var update = dhtmlx.bind(function(){this.data.refresh();},this);pager.attachEvent("onRefresh",update);this.data.attachEvent("onStoreUpdated",function(data){var count = this.dataCount();if (count != pager._settings.count){pager._settings.count = count;if (pager._settings.page == -1)pager._settings.page = 0;pager.refresh();}
 });return pager;},
 
 height_setter:function(value){if (value=="auto"){this.attachEvent("onAfterRender",this._correct_height);dhtmlx.event(window,"resize",dhtmlx.bind(this._correct_height,this));}
 return value;},
 
 _correct_height:function(){this._dataobj.style.overflow="hidden";this._dataobj.style.height = "1px";var t = this._dataobj.scrollHeight;this._dataobj.style.height = t+"px";if (dhtmlx._isFF){var t2 = this._dataobj.scrollHeight;if (t2!=t)this._dataobj.style.height = t2+"px";}
 this._obj.style.height = this._dataobj.style.height;},
 
 _getDimension:function(){var t = this.type;var d = (t.border||0)+(t.padding||0)*2+(t.margin||0)*2;return {x : t.width+d, y: t.height+d };},
 
 x_count_setter:function(value){var dim = this._getDimension();this._dataobj.style.width = dim.x*value+(this._settings.height != "auto"?18:0)+"px";return value;},
 
 
 y_count_setter:function(value){var dim = this._getDimension();this._dataobj.style.height = dim.y*value+"px";return value;}
};dhtmlx.VirtualRenderStack={_init:function(){dhtmlx.assert(this.render,"VirtualRenderStack :: Object must use RenderStack first");this._htmlmap={};this._dataobj.style.overflowY="scroll";dhtmlx.event(this._dataobj,"scroll",dhtmlx.bind(this._render_visible_rows,this));dhtmlx.event(window,"resize",dhtmlx.bind(function(){this.render();},this));this.data._unrendered_area=[];this.data.getIndexRange=this._getIndexRange;},
 
 _locateHTML:function(search_id){return this._htmlmap[search_id];},
 
 show:function(id){range = this._getVisibleRange();var ind = this.data.indexById(id);var dy = Math.floor(ind/range._dx)*range._y;this._dataobj.scrollTop = dy;}, 
 _getIndexRange:function(from,to){if (to !== 0)to=Math.min((to||Infinity),this.dataCount()-1);var ret=dhtmlx.toArray();for (var i=(from||0);i <= to;i++){var item = this.item(this.order[i]);if(this.order.length>i){if (!item){this.order[i]=dhtmlx.uid();item = {id:this.order[i], $template:"loading" };this._unrendered_area.push(this.order[i]);}else if (item.$template == "loading")this._unrendered_area.push(this.order[i]);ret.push(item);}
 }
 return ret;}, 
 
 
 render:function(id,data,type,after){if (id){var cont = this._locateHTML(id);switch(type){case "update":
 if (!cont)return;var t = this._htmlmap[id] = this._toHTMLObject(data);dhtmlx.html.insertBefore(t, cont);dhtmlx.html.remove(cont);break;default: 
 
 this._render_delayed();break;}
 }else {if (this.callEvent("onBeforeRender",[this.data])){this._htmlmap = {};this._render_visible_rows(null, true);this._wait_for_render = false;this.callEvent("onAfterRender",[]);}
 }
 },
 
 _render_delayed:function(){if (this._wait_for_render)return;this._wait_for_render = true;window.setTimeout(dhtmlx.bind(function(){this.render();},this),1);},
 
 _create_placeholder:function(height){var node = document.createElement("DIV");node.style.cssText = "height:"+height+"px;width:100%;overflow:hidden;";return node;},
 
 _render_visible_rows:function(e,reset){this.data._unrendered_area=[];var viewport = this._getVisibleRange();if (!this._dataobj.firstChild || reset){this._dataobj.innerHTML="";this._dataobj.appendChild(this._create_placeholder(viewport._max));this._htmlrows = [this._dataobj.firstChild];}
 
 

 
 var t = viewport._from;var max_row = (this.data.max || this.data.max === 0)?this.data.max:Infinity;while(t<=viewport._height){while(this._htmlrows[t] && this._htmlrows[t]._filled && t<=viewport._height){t++;}
 
 if (t>viewport._height)break;var holder = t;while (!this._htmlrows[holder])holder--;var holder_row = this._htmlrows[holder];var base = t*viewport._dx+(this.data.min||0);if (base > max_row)break;var nextpoint = Math.min(base+viewport._dx-1,max_row);var node = this._create_placeholder(viewport._y);var range = this.data.getIndexRange(base, nextpoint);if (!range.length)break;node.innerHTML=range.map(this._toHTML,this).join("");for (var i=0;i < range.length;i++)this._htmlmap[this.data.idByIndex(base+i)]=node.childNodes[i];var h = parseInt(holder_row.style.height,10);var delta = (t-holder)*viewport._y;var delta2 = (h-delta-viewport._y);dhtmlx.html.insertBefore(node,delta?holder_row.nextSibling:holder_row,this._dataobj);this._htmlrows[t]=node;node._filled = true;if (delta <= 0 && delta2>0){holder_row.style.height = delta2+"px";this._htmlrows[t+1] = holder_row;}else {if (delta<0)dhtmlx.html.remove(holder_row);else
 holder_row.style.height = delta+"px";if (delta2>0){var new_space = this._htmlrows[t+1] = this._create_placeholder(delta2);dhtmlx.html.insertBefore(new_space,node.nextSibling,this._dataobj);}
 }
 
 
 t++;}
 
 if (this.data._unrendered_area.length){var from = this.indexById(this.data._unrendered_area[0]);var to = this.indexById(this.data._unrendered_area.pop())+1;if (to>from){if (!this.callEvent("onDataRequest",[from, to-from])) return false;dhtmlx.assert(this.data.feed,"Data feed is missed");this.data.feed.call(this,from,to-from);}
 }
 if (dhtmlx._isIE){var viewport2 = this._getVisibleRange();if (viewport2._from != viewport._from)this._render_visible_rows();}
 },
 
 _getVisibleRange:function(){var top = this._dataobj.scrollTop;var width = Math.max(this._dataobj.scrollWidth,this._dataobj.offsetWidth)-18;var height = this._dataobj.offsetHeight;var t = this.type;var dim = this._getDimension();var dx = Math.floor(width/dim.x)||1;var min = Math.floor(top/dim.y);var dy = Math.ceil((height+top)/dim.y)-1;var count = this.data.max?(this.data.max-this.data.min):this.data.dataCount();var max = Math.ceil(count/dx)*dim.y;return {_from:min, _height:dy, _top:top, _max:max, _y:dim.y, _dx:dx};}
};dhtmlx.ajax = function(url,call,master){if (arguments.length!==0){var http_request = new dhtmlx.ajax();if (master)http_request.master=master;http_request.get(url,null,call);}
 if (!this.getXHR)return new dhtmlx.ajax();return this;};dhtmlx.ajax.prototype={getXHR:function(){if (dhtmlx._isIE)return new ActiveXObject("Microsoft.xmlHTTP");else 
 return new XMLHttpRequest();},
 
 send:function(url,params,call){var x=this.getXHR();if (typeof call == "function")call = [call];if (typeof params == "object"){var t=[];for (var a in params){var value = params[a];if (value === null || value === dhtmlx.undefined)value = "";t.push(a+"="+encodeURIComponent(value));}
 params=t.join("&");}
 if (params && !this.post){url=url+(url.indexOf("?")!=-1 ? "&" : "?")+params;params=null;}
 
 x.open(this.post?"POST":"GET",url,!this._sync);if (this.post)x.setRequestHeader('Content-type','application/x-www-form-urlencoded');var self=this;x.onreadystatechange= function(){if (!x.readyState || x.readyState == 4){if (call && self)for (var i=0;i < call.length;i++)if (call[i])call[i].call((self.master||self),x.responseText,x.responseXML,x);self.master=null;call=self=null;}
 };x.send(params||null);return x;},
 
 get:function(url,params,call){this.post=false;return this.send(url,params,call);},
 
 post:function(url,params,call){this.post=true;return this.send(url,params,call);}, 
 sync:function(){this._sync = true;return this;}
};dhtmlx.AtomDataLoader={_init:function(config){this.data = {};if (config){this._settings.datatype = config.datatype||"json";this._after_init.push(this._load_when_ready);}
 },
 _load_when_ready:function(){this._ready_for_data = true;if (this._settings.url)this.url_setter(this._settings.url);if (this._settings.data)this.data_setter(this._settings.data);},
 url_setter:function(value){if (!this._ready_for_data)return value;this.load(value, this._settings.datatype);return value;},
 data_setter:function(value){if (!this._ready_for_data)return value;this.parse(value, this._settings.datatype);return true;},
 
 load:function(url,call){this.callEvent("onXLS",[]);if (typeof call == "string"){this.data.driver = dhtmlx.DataDriver[call];call = arguments[2];}
 else
 this.data.driver = dhtmlx.DataDriver["xml"];dhtmlx.ajax(url,[this._onLoad,call],this);},
 
 parse:function(data,type){this.callEvent("onXLS",[]);this.data.driver = dhtmlx.DataDriver[type||"xml"];this._onLoad(data,null);},
 
 _onLoad:function(text,xml,loader){var driver = this.data.driver;var top = driver.getRecords(driver.toObject(text,xml))[0];this.data=(driver?driver.getDetails(top):text);this.callEvent("onXLE",[]);},
 _check_data_feed:function(data){if (!this._settings.dataFeed || this._ignore_feed || !data)return true;var url = this._settings.dataFeed;if (typeof url == "function")return url.call(this, (data.id||data), data);url = url+(url.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(data.id||data);this.callEvent("onXLS",[]);dhtmlx.ajax(url, function(text,xml){this._ignore_feed=true;this.setValues(dhtmlx.DataDriver.json.toObject(text)[0]);this._ignore_feed=false;this.callEvent("onXLE",[]);}, this);return false;}
};dhtmlx.DataDriver={};dhtmlx.DataDriver.json={toObject:function(data){if (!data)data="[]";if (typeof data == "string"){eval ("dhtmlx.temp="+data);return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){if (data && !(data instanceof Array))
 return [data];return data;},
 
 getDetails:function(data){return data;},
 
 getInfo:function(data){return {_size:(data.total_count||0),
 _from:(data.pos||0),
 _key:(data.dhx_security)
 };}
};dhtmlx.DataDriver.json_ext={toObject:function(data){if (!data)data="[]";if (typeof data == "string"){var temp;eval ("temp="+data);dhtmlx.temp = [];var header = temp.header;for (var i = 0;i < temp.data.length;i++){var item = {};for (var j = 0;j < header.length;j++){if (typeof(temp.data[i][j])!= "undefined")
 item[header[j]] = temp.data[i][j];}
 dhtmlx.temp.push(item);}
 return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){if (data && !(data instanceof Array))
 return [data];return data;},
 
 getDetails:function(data){return data;},
 
 getInfo:function(data){return {_size:(data.total_count||0),
 _from:(data.pos||0)
 };}
};dhtmlx.DataDriver.html={toObject:function(data){if (typeof data == "string"){var t=null;if (data.indexOf("<")==-1) 
 t = dhtmlx.toNode(data);if (!t){t=document.createElement("DIV");t.innerHTML = data;}
 
 return t.getElementsByTagName(this.tag);}
 return data;},
 
 getRecords:function(data){if (data.tagName)return data.childNodes;return data;},
 
 getDetails:function(data){return dhtmlx.DataDriver.xml.tagToObject(data);},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };},
 tag: "LI"
};dhtmlx.DataDriver.jsarray={toObject:function(data){if (typeof data == "string"){eval ("dhtmlx.temp="+data);return dhtmlx.temp;}
 return data;},
 
 getRecords:function(data){return data;},
 
 getDetails:function(data){var result = {};for (var i=0;i < data.length;i++)result["data"+i]=data[i];return result;},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };}
};dhtmlx.DataDriver.csv={toObject:function(data){return data;},
 
 getRecords:function(data){return data.split(this.row);},
 
 getDetails:function(data){data = this.stringToArray(data);var result = {};for (var i=0;i < data.length;i++)result["data"+i]=data[i];return result;},
 
 getInfo:function(data){return {_size:0,
 _from:0
 };},
 
 stringToArray:function(data){data = data.split(this.cell);for (var i=0;i < data.length;i++)data[i] = data[i].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"");return data;},
 row:"\n", 
 cell:"," 
};dhtmlx.DataDriver.xml={toObject:function(text,xml){if (xml && (xml=this.checkResponse(text,xml))) 
 return xml;if (typeof text == "string"){return this.fromString(text);}
 return text;},
 
 getRecords:function(data){return this.xpath(data,this.records);},
 records:"/*/item",
 
 getDetails:function(data){return this.tagToObject(data,{});},
 
 getInfo:function(data){return {_size:(data.documentElement.getAttribute("total_count")||0),
 _from:(data.documentElement.getAttribute("pos")||0),
 _key:(data.documentElement.getAttribute("dhx_security"))
 };},
 
 xpath:function(xml,path){if (window.XPathResult){var node=xml;if(xml.nodeName.indexOf("document")==-1)
 xml=xml.ownerDocument;var res = [];var col = xml.evaluate(path, node, null, XPathResult.ANY_TYPE, null);var temp = col.iterateNext();while (temp){res.push(temp);temp = col.iterateNext();}
 return res;}
 else {var test = true;try {if (typeof(xml.selectNodes)=="undefined")
 test = false;}catch(e){}
 
 if (test)return xml.selectNodes(path);else {var name = path.split("/").pop();return xml.getElementsByTagName(name);}
 }
 },
 
 tagToObject:function(tag,z){z=z||{};var flag=false;var a=tag.attributes;if(a && a.length){for (var i=0;i<a.length;i++)z[a[i].name]=a[i].value;flag = true;}
 
 
 var b=tag.childNodes;var state = {};for (var i=0;i<b.length;i++){if (b[i].nodeType==1){var name = b[i].tagName;if (typeof z[name] != "undefined"){if (!(z[name] instanceof Array))
 z[name]=[z[name]];z[name].push(this.tagToObject(b[i],{}));}
 else
 z[b[i].tagName]=this.tagToObject(b[i],{});flag=true;}
 }
 
 if (!flag)return this.nodeValue(tag);z.value = this.nodeValue(tag);return z;},
 
 nodeValue:function(node){if (node.firstChild)return node.firstChild.data;return "";},
 
 fromString:function(xmlString){if (window.DOMParser && !dhtmlx._isIE)return (new DOMParser()).parseFromString(xmlString,"text/xml");if (window.ActiveXObject){var temp=new ActiveXObject("Microsoft.xmlDOM");temp.loadXML(xmlString);return temp;}
 dhtmlx.error("Load from xml string is not supported");},
 
 checkResponse:function(text,xml){if (xml && ( xml.firstChild && xml.firstChild.tagName != "parsererror"))
 return xml;var a=this.fromString(text.replace(/^[\s]+/,""));if (a)return a;dhtmlx.error("xml can't be parsed",text);}
};dhtmlx.DataLoader={_init:function(config){config = config || "";this.name = "DataStore";this.data = (config.datastore)||(new dhtmlx.DataStore());this._readyHandler = this.data.attachEvent("onStoreLoad",dhtmlx.bind(this._call_onready,this));},
 
 load:function(url,call){dhtmlx.AtomDataLoader.load.apply(this, arguments);if (!this.data.feed)this.data.feed = function(from,count){if (this._load_count)return this._load_count=[from,count];else
 this._load_count=true;this.load(url+((url.indexOf("?")==-1)?"?":"&")+"posStart="+from+"&count="+count,function(){var temp = this._load_count;this._load_count = false;if (typeof temp =="object")this.data.feed.apply(this, temp);});};},
 
 _onLoad:function(text,xml,loader){this.data._parse(this.data.driver.toObject(text,xml));this.callEvent("onXLE",[]);if(this._readyHandler){this.data.detachEvent(this._readyHandler);this._readyHandler = null;}
 },
 dataFeed_setter:function(value){this.data.attachEvent("onBeforeFilter", dhtmlx.bind(function(text, value){if (this._settings.dataFeed){var filter = {};if (!text && !filter)return;if (typeof text == "function"){if (!value)return;text(value, filter);}else 
 filter = {text:value };this.clearAll();var url = this._settings.dataFeed;if (typeof url == "function")return url.call(this, value, filter);var urldata = [];for (var key in filter)urldata.push("dhx_filter["+key+"]="+encodeURIComponent(filter[key]));this.load(url+(url.indexOf("?")<0?"?":"&")+urldata.join("&"), this._settings.datatype);return false;}
 },this));return value;},
 _call_onready:function(){if (this._settings.ready){var code = dhtmlx.toFunctor(this._settings.ready);if (code && code.call)code.apply(this, arguments);}
 }
};dhtmlx.DataStore = function(){this.name = "DataStore";dhtmlx.extend(this, dhtmlx.EventSystem);this.setDriver("xml");this.pull = {};this.order = dhtmlx.toArray();};dhtmlx.DataStore.prototype={setDriver:function(type){dhtmlx.assert(dhtmlx.DataDriver[type],"incorrect DataDriver");this.driver = dhtmlx.DataDriver[type];},
 
 _parse:function(data){this.callEvent("onParse", [this.driver, data]);if (this._filter_order)this.filter();var info = this.driver.getInfo(data);if (info._key)dhtmlx.security_key = info._key;var recs = this.driver.getRecords(data);var from = (info._from||0)*1;if (from === 0 && this.order[0])from = this.order.length;var j=0;for (var i=0;i<recs.length;i++){var temp = this.driver.getDetails(recs[i]);var id = this.id(temp);if (!this.pull[id]){this.order[j+from]=id;j++;}
 this.pull[id]=temp;if (this.extraParser)this.extraParser(temp);if (this._scheme){if (this._scheme.$init)this._scheme.$update(temp);else if (this._scheme.$update)this._scheme.$update(temp);}
 }
 
 for (var i=0;i < info._size;i++)if (!this.order[i]){var id = dhtmlx.uid();var temp = {id:id, $template:"loading"};this.pull[id]=temp;this.order[i]=id;}
 this.callEvent("onStoreLoad",[this.driver, data]);this.refresh();},
 
 id:function(data){return data.id||(data.id=dhtmlx.uid());},
 changeId:function(old, newid){dhtmlx.assert(this.pull[old],"Can't change id, for non existing item: "+old);this.pull[newid] = this.pull[old];this.pull[newid].id = newid;this.order[this.order.find(old)]=newid;if (this._filter_order)this._filter_order[this._filter_order.find(old)]=newid;this.callEvent("onIdChange", [old, newid]);if (this._render_change_id)this._render_change_id(old, newid);},
 get:function(id){return this.item(id);},
 set:function(id, data){return this.update(id, data);},
 
 item:function(id){return this.pull[id];},
 
 update:function(id,data){if (this._scheme && this._scheme.$update)this._scheme.$update(data);if (this.callEvent("onBeforeUpdate", [id, data])=== false) return false;this.pull[id]=data;this.refresh(id);},
 
 refresh:function(id){if (this._skip_refresh)return;if (id)this.callEvent("onStoreUpdated",[id, this.pull[id], "update"]);else
 this.callEvent("onStoreUpdated",[null,null,null]);},
 silent:function(code){this._skip_refresh = true;code.call(this);this._skip_refresh = false;},
 
 getRange:function(from,to){if (from)from = this.indexById(from);else 
 from = this.startOffset||0;if (to)to = this.indexById(to);else {to = Math.min((this.endOffset||Infinity),(this.dataCount()-1));if (to<0)to = 0;}
 if (from>to){var a=to;to=from;from=a;}
 
 return this.getIndexRange(from,to);},
 
 getIndexRange:function(from,to){to=Math.min((to||Infinity),this.dataCount()-1);var ret=dhtmlx.toArray();for (var i=(from||0);i <= to;i++)
 ret.push(this.item(this.order[i]));return ret;},
 
 dataCount:function(){return this.order.length;},
 
 exists:function(id){return !!(this.pull[id]);},
 
 
 move:function(sindex,tindex){if (sindex<0 || tindex<0){dhtmlx.error("DataStore::move","Incorrect indexes");return;}
 
 var id = this.idByIndex(sindex);var obj = this.item(id);this.order.removeAt(sindex);this.order.insertAt(id,Math.min(this.order.length, tindex));this.callEvent("onStoreUpdated",[id,obj,"move"]);},
 scheme:function(config){this._scheme = config;},
 sync:function(source, filter, silent){if (typeof filter != "function"){silent = filter;filter = null;}
 
 if (dhtmlx.debug_bind){this.debug_sync_master = source;dhtmlx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id);}
 
 var topsource = source;if (source.name != "DataStore")source = source.data;var sync_logic = dhtmlx.bind(function(id, data, mode){if (mode != "update" || filter)id = null;if (!id){this.order = dhtmlx.toArray([].concat(source.order));this._filter_order = null;this.pull = source.pull;if (filter)this.silent(filter);if (this._on_sync)this._on_sync();}
 if (dhtmlx.debug_bind)dhtmlx.log("[sync:request] "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id + " <= "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id);if (!silent)this.refresh(id);else
 silent = false;}, this);source.attachEvent("onStoreUpdated", sync_logic);this.feed = function(from, count){topsource.loadNext(count, from);};sync_logic();},
 
 add:function(obj,index){if (this._scheme){obj = obj||{};for (var key in this._scheme)obj[key] = obj[key]||this._scheme[key];if (this._scheme){if (this._scheme.$init)this._scheme.$update(obj);else if (this._scheme.$update)this._scheme.$update(obj);}
 }
 
 
 var id = this.id(obj);var data_size = this.dataCount();if (dhtmlx.isNotDefined(index)|| index < 0)
 index = data_size;if (index > data_size){dhtmlx.log("Warning","DataStore:add","Index of out of bounds");index = Math.min(this.order.length,index);}
 if (this.callEvent("onBeforeAdd", [id, obj, index])=== false) return false;if (this.exists(id)) return dhtmlx.error("Not unique ID");this.pull[id]=obj;this.order.insertAt(id,index);if (this._filter_order){var original_index = this._filter_order.length;if (!index && this.order.length)original_index = 0;this._filter_order.insertAt(id,original_index);}
 this.callEvent("onafterAdd",[id,index]);this.callEvent("onStoreUpdated",[id,obj,"add"]);return id;},
 
 
 remove:function(id){if (id instanceof Array){for (var i=0;i < id.length;i++)this.remove(id[i]);return;}
 if (this.callEvent("onBeforeDelete",[id])=== false) return false;if (!this.exists(id)) return dhtmlx.error("Not existing ID",id);var obj = this.item(id);this.order.remove(id);if (this._filter_order)this._filter_order.remove(id);delete this.pull[id];this.callEvent("onafterdelete",[id]);this.callEvent("onStoreUpdated",[id,obj,"delete"]);},
 
 clearAll:function(){this.pull = {};this.order = dhtmlx.toArray();this.feed = null;this._filter_order = null;this.callEvent("onClearAll",[]);this.refresh();},
 
 idByIndex:function(index){if (index>=this.order.length || index<0)dhtmlx.log("Warning","DataStore::idByIndex Incorrect index");return this.order[index];},
 
 indexById:function(id){var res = this.order.find(id);return res;},
 
 next:function(id,step){return this.order[this.indexById(id)+(step||1)];},
 
 first:function(){return this.order[0];},
 
 last:function(){return this.order[this.order.length-1];},
 
 previous:function(id,step){return this.order[this.indexById(id)-(step||1)];},
 
 sort:function(by, dir, as){var sort = by;if (typeof by == "function")sort = {as:by, dir:dir};else if (typeof by == "string")sort = {by:by, dir:dir, as:as};var parameters = [sort.by, sort.dir, sort.as];if (!this.callEvent("onbeforesort",parameters)) return;if (this.order.length){var sorter = dhtmlx.sort.create(sort);var neworder = this.getRange(this.first(), this.last());neworder.sort(sorter);this.order = neworder.map(function(obj){return this.id(obj);},this);}
 
 
 this.refresh();this.callEvent("onaftersort",parameters);},
 
 filter:function(text,value){if (!this.callEvent("onBeforeFilter", [text, value])) return;if (this._filter_order){this.order = this._filter_order;delete this._filter_order;}
 
 if (!this.order.length)return;if (text){var filter = text;value = value||"";if (typeof text == "string"){text = dhtmlx.Template.fromHTML(text);value = value.toString().toLowerCase();filter = function(obj,value){return text(obj).toLowerCase().indexOf(value)!=-1;};}
 
 
 var neworder = dhtmlx.toArray();for (var i=0;i < this.order.length;i++){var id = this.order[i];if (filter(this.item(id),value))
 neworder.push(id);}
 
 this._filter_order = this.order;this.order = neworder;}
 
 this.refresh();this.callEvent("onAfterFilter", []);},
 
 each:function(method,master){for (var i=0;i<this.order.length;i++)method.call((master||this), this.item(this.order[i]));},
 
 provideApi:function(target,eventable){this.debug_bind_master = target;if (eventable){this.mapEvent({onbeforesort: target,
 onaftersort: target,
 onbeforeadd: target,
 onafteradd: target,
 onbeforedelete: target,
 onafterdelete: target,
 onbeforeupdate: target
 });}
 
 var list = ["get","set","sort","add","remove","exists","idByIndex","indexById","item","update","refresh","dataCount","filter","next","previous","clearAll","first","last","serialize"];for (var i=0;i < list.length;i++)target[list[i]]=dhtmlx.methodPush(this,list[i]);if (dhtmlx.assert_enabled()) 
 this.assert_event(target);},
 
 serialize: function(){var ids = this.order;var result = [];for(var i=0;i< ids.length;i++)result.push(this.pull[ids[i]]);return result;}
};dhtmlx.sort = {create:function(config){return dhtmlx.sort.dir(config.dir, dhtmlx.sort.by(config.by, config.as));},
 as:{"int":function(a,b){a = a*1;b=b*1;return a>b?1:(a<b?-1:0);},
 "string_strict":function(a,b){a = a.toString();b=b.toString();return a>b?1:(a<b?-1:0);},
 "string":function(a,b){a = a.toString().toLowerCase();b=b.toString().toLowerCase();return a>b?1:(a<b?-1:0);}
 },
 by:function(prop, method){if (!prop)return method;if (typeof method != "function")method = dhtmlx.sort.as[method||"string"];prop = dhtmlx.Template.fromHTML(prop);return function(a,b){return method(prop(a),prop(b));};},
 dir:function(prop, method){if (prop == "asc")return method;return function(a,b){return method(a,b)*-1;};}
};if (!dhtmlx.attaches)dhtmlx.attaches = {};dhtmlx.attaches.attachAbstract=function(name, conf){var obj = document.createElement("DIV");obj.id = "CustomObject_"+dhtmlx.uid();obj.style.width = "100%";obj.style.height = "100%";obj.cmp = "grid";document.body.appendChild(obj);this.attachObject(obj.id);conf.container = obj.id;var that = this.vs[this.av];that.grid = new window[name](conf);that.gridId = obj.id;that.gridObj = obj;that.grid.setSizes = function(){if (this.resize)this.resize();else this.render();};var method_name="_viewRestore";return this.vs[this[method_name]()].grid;};dhtmlx.attaches.attachDataView = function(conf){return this.attachAbstract("dhtmlXDataView",conf);};dhtmlx.attaches.attachChart = function(conf){return this.attachAbstract("dhtmlXChart",conf);};dhtmlx.compat.layout = function(){};dhtmlXDataView = function(container){this.name = "DataView";this.version = "3.0";if (dhtmlx.assert_enabled()) this._assert();dhtmlx.extend(this, dhtmlx.Settings);this._parseContainer(container,"dhx_dataview");dhtmlx.extend(this, dhtmlx.AtomDataLoader);dhtmlx.extend(this, dhtmlx.DataLoader);dhtmlx.extend(this, dhtmlx.EventSystem);dhtmlx.extend(this, dhtmlx.RenderStack);dhtmlx.extend(this, dhtmlx.SelectionModel);dhtmlx.extend(this, dhtmlx.MouseEvents);dhtmlx.extend(this, dhtmlx.KeyEvents);dhtmlx.extend(this, dhtmlx.EditAbility);dhtmlx.extend(this, dhtmlx.DataMove);dhtmlx.extend(this, dhtmlx.DragItem);dhtmlx.extend(this, dhtmlx.DataProcessor);dhtmlx.extend(this, dhtmlx.AutoTooltip);dhtmlx.extend(this, dhtmlx.Destruction);this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render.apply(this,arguments);},this));this._parseSettings(container,{drag:false,
 edit:false,
 select:"multiselect", 
 type:"default"
 });if (this._settings.height!="auto"&&!this._settings.renderAll)dhtmlx.extend(this, dhtmlx.VirtualRenderStack);this.data.provideApi(this,true);};dhtmlXDataView.prototype={bind:function(){dhx.BaseBind.legacyBind.apply(this, arguments);},
 sync:function(){dhx.BaseBind.legacySync.apply(this, arguments);},
 
 dragMarker:function(context,ev){var el = this._locateHTML(context.target);if (this.type.drag_marker){if (this._drag_marker){this._drag_marker.style.backgroundImage="";this._drag_marker.style.backgroundRepeat="";}
 
 
 if (el){el.style.backgroundImage="url("+(dhtmlx.image_path||"")+this.type.drag_marker+")";el.style.backgroundRepeat="no-repeat";this._drag_marker = el;}
 }
 
 
 if (el && this._settings.auto_scroll){var dy = el.offsetTop;var dh = el.offsetHeight;var py = this._obj.scrollTop;var ph = this._obj.offsetHeight;if (dy-dh >= 0 && dy-dh*0.75 < py)py = Math.max(dy-dh, 0);else if (dy+dh/0.75 > py+ph)py = py+dh;this._obj.scrollTop = py;}
 return true;},
 
 _id:"dhx_f_id",
 
 on_click:{dhx_dataview_item:function(e,id){if (this.stopEdit(false,id)){if (this._settings.select){if (this._settings.select=="multiselect")this.select(id, e.ctrlKey, e.shiftKey);else
 this.select(id);}
 }
 }
 },
 
 on_dblclick:{dhx_dataview_item:function(e,id){if (this._settings.edit)this.edit(id);}
 },
 
 on_mouse_move:{},
 types:{"default":{css:"default",
 
 template:dhtmlx.Template.fromHTML("<div style='padding:10px;white-space:nowrap;overflow:hidden;'>{obj.text}</div>"),
 
 template_edit:dhtmlx.Template.fromHTML("<div style='padding:10px;white-space:nowrap;overflow:hidden;'><textarea style='width:100%;height:100%;' bind='obj.text'></textarea></div>"),
 
 template_loading:dhtmlx.Template.fromHTML("<div style='padding:10px;white-space:nowrap;overflow:hidden;'>Loading...</div>"),
 width:210,
 height:115,
 margin:0,
 padding:10,
 border:1
 }
 },
 template_item_start:dhtmlx.Template.fromHTML("<div dhx_f_id='{-obj.id}' class='dhx_dataview_item dhx_dataview_{obj.css}_item{-obj.$selected?_selected:}' style='width:{obj.width}px;height:{obj.height}px;padding:{obj.padding}px;margin:{obj.margin}px;float:left;overflow:hidden;'>"),
 template_item_end:dhtmlx.Template.fromHTML("</div>")
};dhtmlx.compat("layout");function dhtmlXEditor(base, skin) {var that = this;this.skin = (skin||dhtmlx.skin||"dhx_skyblue");this.iconsPath = dhtmlx.image_path||"../../codebase/imgs/";if (typeof(base)== "string") base = document.getElementById(base);this.base = base;while (this.base.childNodes.length > 0)this.base.removeChild(this.base.childNodes[0]);this._isToolbar = (this.initDhtmlxToolbar!=null&&window.dhtmlXToolbarObject!=null?true:false);if (!this._isToolbar){this.tbData = "<div class='dhxeditor_"+this.skin+"_btns'>"+
 "<a href='javascript:void(0);' onclick='return false;' tabindex='-1'><div actv='b' cmd='applyBold' class='dhxeditor_"+this.skin+"_tbbtn btn_bold'></div></a>"+
 "<a href='javascript:void(0);' onclick='return false;' tabindex='-1'><div actv='i' cmd='applyItalic' class='dhxeditor_"+this.skin+"_tbbtn btn_italic'></div></a>"+
 "<a href='javascript:void(0);' onclick='return false;' tabindex='-1'><div actv='u' cmd='applyUnderscore' class='dhxeditor_"+this.skin+"_tbbtn btn_underline'></div></a>"+
 "<a href='javascript:void(0);' onclick='return false;' tabindex='-1'><div actv='c' cmd='clearFormatting' class='dhxeditor_"+this.skin+"_tbbtn btn_clearformat'></div></a>"+
 "<div class='verline_l'></div><div class='verline_r'></div>"+
 "</div>";}else {this.tbData = "";}
 
 
 var pos = (_isIE?this.base.currentStyle["position"]:window.getComputedStyle(this.base, null).getPropertyValue("position"));if (!(pos == "relative" || pos == "absolute")) this.base.style.position = "relative";this.base.innerHTML = this.tbData+"<div style='position:absolute;width: 100%;overflow: hidden;'></div>";var dhxCont = new dhtmlXContainerLite(this.base);dhxCont.skin = this.skin;dhxCont.setContent(this.base.childNodes[(this._isToolbar?0:1)]);var ofs = (this._isToolbar?0:this.base.childNodes[0].offsetHeight);this.base.adjustContent(this.base, ofs);this.cBlock = document.createElement("DIV");this.cBlock.className = "dhxcont_content_blocker";this.cBlock.style.display = "none";this.base.appendChild(this.cBlock);this.editor = document.createElement("IFRAME");this.editor.className = "dhxeditor_mainiframe_"+this.skin;this.editor.frameBorder = 0;if (_isOpera)this.editor.scrolling = "yes";var fr = this.editor;if (_isIE){fr.onreadystatechange = function(a) {if (fr.readyState == "complete"){try {this.contentWindow.document.body.attachEvent("onfocus",function(e){that._ev("focus",e);});this.contentWindow.document.body.attachEvent("onblur",function(e){that._ev("blur",e);});this.contentWindow.document.body.attachEvent("onkeydown",function(e){that._ev("keydown",e);});this.contentWindow.document.body.attachEvent("onkeyup",function(e){that._ev("keyup",e);});this.contentWindow.document.body.attachEvent("onkeypress",function(e){that._ev("keypress",e);});this.contentWindow.document.body.attachEvent("onmouseup",function(e){that._ev("mouseup",e);});this.contentWindow.document.body.attachEvent("onmousedown",function(e){that._ev("mousedown",e);});this.contentWindow.document.body.attachEvent("onclick",function(e){that._ev("click",e);});}catch(e){};}
 }
 fr.onunload = function() {this.contentWindow.document.body.detachEvent("onfocus",function(){that._ev("focus",event);});this.contentWindow.document.body.detachEvent("onblur",function(){that._ev("blur",event);});this.contentWindow.document.body.detachEvent("onkeydown",function(){that._ev("keydown",event);});this.contentWindow.document.body.detachEvent("onkeyup",function(){that._ev("keyup",event);});this.contentWindow.document.body.detachEvent("onkeypress",function(){that._ev("keypress",event);});this.contentWindow.document.body.detachEvent("onmouseup",function(){that._ev("mouseup",event);});this.contentWindow.document.body.detachEvent("onmousedown",function(){that._ev("mousedown",event);});this.contentWindow.document.body.detachEvent("onclick",function(){that._ev("click",event);});}
 }else {var e = this.editor;fr.onload = function() {this.contentWindow.addEventListener("focus",function(e){that._ev("focus",e);},false);this.contentWindow.addEventListener("blur",function(e){that._ev("blur",e);},false);this.contentWindow.addEventListener("keydown",function(e){that._ev("keydown",e);},false);this.contentWindow.addEventListener("keyup",function(e){that._ev("keyup",e);},false);this.contentWindow.addEventListener("keypress",function(e){that._ev("keypress",e);},false);this.contentWindow.addEventListener("mouseup",function(e){that._ev("mouseup",e);},false);this.contentWindow.addEventListener("mousedown",function(e){that._ev("mousedown",e);},false);this.contentWindow.addEventListener("click",function(e){that._ev("click",e);},false);}
 fr.onunload = function(){this.contentWindow.removeEventListener("focus",function(e){that._ev("focus",e);},false);this.contentWindow.removeEventListener("blur",function(e){that._ev("blur",e);},false);this.contentWindow.removeEventListener("keydown",function(e){that._ev("keydown",e);},false);this.contentWindow.removeEventListener("keyup",function(e){that._ev("keyup",e);},false);this.contentWindow.removeEventListener("keypress",function(e){that._ev("keypress",e);},false);this.contentWindow.removeEventListener("mouseup",function(e){that._ev("mouseup",e);},false);this.contentWindow.removeEventListener("mousedown",function(e){that._ev("mousedown",e);},false);this.contentWindow.removeEventListener("click",function(e){that._ev("click",e);},false);}
 }
 
 this._ev = function(t,ev) {this.callEvent("onAccess",[t,ev]);}
 this._focus = function() {if (_isIE){this.editor.contentWindow.document.body.focus();}else {this.editor.contentWindow.focus();}
 }
 
 
 this.base.attachObject(this.editor);this.edWin = this.editor.contentWindow;this.edDoc = this.edWin.document;this._prepareContent = function(saveContent, roMode) {var storedContent = "";if (saveContent === true && this.getContent != null)storedContent = this.getContent();var edDoc = this.editor.contentWindow.document;edDoc.open("text/html", "replace");if (_isOpera){edDoc.write("<html><head><style> html, body {overflow:auto;-webkit-overflow-scrolling: touch;padding:0px;padding-left:1px !important;height:100%;margin:0px;font-family:Tahoma;font-size:10pt;background-color:#ffffff;}</style></head><body "+(roMode!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>");}else {if (window._KHTMLrv){edDoc.write("<html><head><style> html {overflow-x: auto;-webkit-overflow-scrolling: touch;overflow-y: auto;}body {overflow: auto;overflow-y: scroll;}html,body {padding:0px;padding-left:1px !important;height:100%;margin:0px;font-family:Tahoma;font-size:10pt;background-color:#ffffff;}</style></head><body "+(roMode!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>");}else {if (_isIE){edDoc.write("<html><head><style> html {overflow-y: auto;}body {overflow-y: scroll;-webkit-overflow-scrolling: touch;}html,body {overflow-x: auto;padding:0px;padding-left:1px !important;height:100%;margin:0px;font-family:Tahoma;font-size:10pt;background-color:#ffffff;}</style></head><body "+(roMode!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>");}else {edDoc.write("<html><head><style> html,body {overflow-x: auto;overflow-y:-webkit-overflow-scrolling: touch;scroll;padding:0px;padding-left:1px !important;height:100%;margin:0px;font-family:Tahoma;font-size:10pt;background-color:#ffffff;}</style></head><body "+(roMode!==true?"contenteditable='true'":"")+" tabindex='0'></body></html>");}
 }
 }
 edDoc.close();if (_isIE)edDoc.contentEditable = (roMode!==true);else edDoc.designMode = (roMode!==true?"On":"Off");if (_isFF)try {edDoc.execCommand("useCSS", false, true);}catch(e) {}
 
 if (saveContent === true && this.setContent != null)this.setContent(storedContent);}
 
 
 this._prepareContent();this.setIconsPath = function() {}
 this.init = function(){}
 
 this.setSizes = function() {var ofs = (this._isToolbar?0:this.base.childNodes[0].offsetHeight);this.base.adjustContent(this.base, ofs);}
 
 this._resizeTM = null;this._resizeTMTime = 100;this._doOnResize = function() {window.clearTimeout(that._resizeTM);that._resizeTM = window.setTimeout(function(){if(that.setSizes)that.setSizes();}, that._resizeTMTime);}
 this._doOnUnload = function() {window.detachEvent("onresize", this._doOnResize);window.removeEventListener("resize", this._doOnResize, false);}
 dhtmlxEvent(window, "resize", this._doOnResize);this.base.childNodes[0].onselectstart = function(e) {e = e||event;e.cancelBubble = true;e.returnValue = false;if (e.preventDefault)e.preventDefault();return false;}
 for (var q=0;q<this.base.childNodes[0].childNodes.length-2;q++){this.base.childNodes[0].childNodes[q].childNodes[0].onmousedown = function(e) {var t = this.getAttribute("cmd");if (typeof that[t] == "function"){that[t]();that.callEvent("onToolbarClick",[this.getAttribute("actv")]);}
 return false;}
 this.base.childNodes[0].childNodes[q].childNodes[0].onclick = function(e) {return false;}
 }
 
 
 this.runCommand = function(name,param){if(this._roMode===true)return;if(arguments.length < 2)param = null;if(_isIE)this.edWin.focus();try {var edDoc = this.editor.contentWindow.document
 edDoc.execCommand(name,false,param);}catch(e){}
 if(_isIE){this.edWin.focus();var self = this;window.setTimeout(function(){self.edWin.focus();},1);}
 }
 
 
 this.applyBold = function() {this.runCommand("Bold");}
 this.applyItalic = function() {this.runCommand("Italic");}
 this.applyUnderscore = function() {this.runCommand("Underline");}
 this.clearFormatting = function() {this.runCommand("RemoveFormat");}
 
 
 if (this._isToolbar)this.initDhtmlxToolbar();dhtmlxEventable(this);dhtmlxEvent(this.edDoc, "click", function(e){var ev = e||window.event;var el = ev.target||ev.srcElement;that.showInfo(el);});if (_isOpera){dhtmlxEvent(this.edDoc, "mousedown", function(e){var ev = e||window.event;var el = ev.target||ev.srcElement;that.showInfo(el);});}
 
 dhtmlxEvent(this.edDoc, "keyup", function(e){var ev = e||window.event;var key = ev.keyCode;var el = ev.target||ev.srcElement;if((key==37)||(key==38)||(key==39)||(key==40)||(key==13))
 that.showInfo(el);});this.attachEvent("onFocusChanged", function(state){if(that._doOnFocusChanged)that._doOnFocusChanged(state);});this.showInfo = function(el){var el = (this.getSelectionBounds().end)?this.getSelectionBounds().end : el;if(!el)return
 try{if(this.edWin.getComputedStyle){var st = this.edWin.getComputedStyle(el, null);var fw = ((st.getPropertyValue("font-weight")==401)?700:st.getPropertyValue("font-weight"));this.style = {fontStyle : st.getPropertyValue("font-style"),
 fontSize : st.getPropertyValue("font-size"),
 textDecoration : st.getPropertyValue("text-decoration"),
 fontWeight : fw,
 fontFamily : st.getPropertyValue("font-family"),
 textAlign : st.getPropertyValue("text-align")
 };if(window._KHTMLrv){this.style.fontStyle = st.getPropertyValue("font-style");this.style.vAlign = st.getPropertyValue("vertical-align");this.style.del = this.isStyleProperty(el,"span","textDecoration","line-through");this.style.u = this.isStyleProperty(el,"span","textDecoration","underline");}
 }
 else{var st = el.currentStyle;this.style = {fontStyle : st.fontStyle,
 fontSize : st.fontSize,
 textDecoration : st.textDecoration,
 fontWeight : st.fontWeight,
 fontFamily : st.fontFamily,
 textAlign : st.textAlign
 };}
 this.setStyleProperty(el,"h1");this.setStyleProperty(el,"h2");this.setStyleProperty(el,"h3");this.setStyleProperty(el,"h4");if(!window._KHTMLrv){this.setStyleProperty(el,"del");this.setStyleProperty(el,"sub");this.setStyleProperty(el,"sup");this.setStyleProperty(el,"u");}
 this.callEvent("onFocusChanged",[this.style, st])
 }
 catch(e){return null}
 }
 
 this.getSelectionBounds = function(){var range, root, start, end;if(this.edWin.getSelection){var selection = this.edWin.getSelection();range = selection.getRangeAt(selection.rangeCount-1);start = range.startContainer;end = range.endContainer;root = range.commonAncestorContainer;if(start.nodeName == "#text")root = root.parentNode;if(start.nodeName == "#text")start = start.parentNode;if (start.nodeName.toLowerCase()== "body") start = start.firstChild;if(end.nodeName == "#text")end = end.parentNode;if (end.nodeName.toLowerCase()== "body") end = end.lastChild;if(start == end)root = start;return {root: root,
 start: start,
 end: end
 }
 }else if(this.edWin.document.selection){range = this.edDoc.selection.createRange()
 if(!range.duplicate)return null;root = range.parentElement();var r1 = range.duplicate();var r2 = range.duplicate();r1.collapse(true);r2.moveToElementText(r1.parentElement());r2.setEndPoint("EndToStart",r1);start = r1.parentElement();r1 = range.duplicate();r2 = range.duplicate();r2.collapse(false);r1.moveToElementText(r2.parentElement());r1.setEndPoint("StartToEnd", r2);end = r2.parentElement();if (start.nodeName.toLowerCase()== "body") start = start.firstChild;if (end.nodeName.toLowerCase()== "body") end = end.lastChild;if(start == end)root = start;return {root: root,
 start: start,
 end: end
 }
 }
 return null 
 }
 
 this.getContent = function(){if (!this.edDoc.body){return "";}else {if (_isFF)return this.editor.contentWindow.document.body.innerHTML.replace(/<\/{0,}br\/{0,}>\s{0,}$/gi,"");if (_isIE && this.edDoc.body.innerText.length == 0)return "";return this.edDoc.body.innerHTML;}
 }
 
 this.setContent = function(str){str = str||"";if (this.edDoc.body){if (navigator.userAgent.indexOf('Firefox')!= -1) {if (typeof(this._ffTest)== "undefined") {this.editor.contentWindow.document.body.innerHTML = "";this.runCommand("InsertHTML", "test");this._ffTest = (this.editor.contentWindow.document.body.innerHTML.length > 0);}
 if (this._ffTest){this.editor.contentWindow.document.body.innerHTML = str;}else {this.editor.contentWindow.document.body.innerHTML = "";if (str.length == 0)str=" ";this.runCommand("InsertHTML", str);}
 }else {this.editor.contentWindow.document.body.innerHTML = str;}
 this.callEvent("onContentSet",[]);}else {dhtmlxEvent(this.edWin, "load", function(e){that.setContent(str);});}
 }
 
 this.setContentHTML = function(url){(new dtmlXMLLoaderObject(this._ajaxOnLoad,this,false,true)).loadXML(url);}
 this._ajaxOnLoad = function(obj,a,b,c,loader){if(loader.xmlDoc.responseText)obj.setContent(loader.xmlDoc.responseText);}
};function dhtmlXContainerLite(obj) {var that = this;this.obj = obj;this.dhxcont = null;this.setContent = function(data) {this.dhxcont = data;this.dhxcont.innerHTML = "<div style='position: relative;left: 0px;top: 0px;overflow: hidden;'></div>";this.dhxcont.mainCont = this.dhxcont.childNodes[0];this.obj.dhxcont = this.dhxcont;}
 
 this.obj._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 
 this.obj.adjustContent = function(parentObj, offsetTop, marginTop, notCalcWidth, offsetBottom) {this.dhxcont.style.left = (this._offsetLeft||0)+"px";this.dhxcont.style.top = (this._offsetTop||0)+offsetTop+"px";var cw = parentObj.clientWidth+(this._offsetWidth||0);if (notCalcWidth !== true)this.dhxcont.style.width = Math.max(0, cw)+"px";if (notCalcWidth !== true)if (this.dhxcont.offsetWidth > cw)this.dhxcont.style.width = Math.max(0, cw*2-this.dhxcont.offsetWidth)+"px";var ch = parentObj.clientHeight+(this._offsetHeight||0);this.dhxcont.style.height = Math.max(0, ch-offsetTop)+(marginTop!=null?marginTop:0)+"px";if (this.dhxcont.offsetHeight > ch - offsetTop)this.dhxcont.style.height = Math.max(0, (ch-offsetTop)*2-this.dhxcont.offsetHeight)+"px";if (offsetBottom)if (!isNaN(offsetBottom)) this.dhxcont.style.height = Math.max(0, parseInt(this.dhxcont.style.height)-offsetBottom)+"px";if (this._minDataSizeH != null){if (parseInt(this.dhxcont.style.height)< this._minDataSizeH) this.dhxcont.style.height = this._minDataSizeH+"px";}
 if (this._minDataSizeW != null){if (parseInt(this.dhxcont.style.width)< this._minDataSizeW) this.dhxcont.style.width = this._minDataSizeW+"px";}
 
 if (notCalcWidth !== true){this.dhxcont.mainCont.style.width = this.dhxcont.clientWidth+"px";if (this.dhxcont.mainCont.offsetWidth > this.dhxcont.clientWidth)this.dhxcont.mainCont.style.width = Math.max(0, this.dhxcont.clientWidth*2-this.dhxcont.mainCont.offsetWidth)+"px";}
 
 var menuOffset = (this.menu!=null?(!this.menuHidden?this.menuHeight:0):0);var toolbarOffset = (this.toolbar!=null?(!this.toolbarHidden?this.toolbarHeight:0):0);var statusOffset = (this.sb!=null?(!this.sbHidden?this.sbHeight:0):0);this.dhxcont.mainCont.style.height = this.dhxcont.clientHeight+"px";if (this.dhxcont.mainCont.offsetHeight > this.dhxcont.clientHeight)this.dhxcont.mainCont.style.height = Math.max(0, this.dhxcont.clientHeight*2-this.dhxcont.mainCont.offsetHeight)+"px";this.dhxcont.mainCont.style.height = Math.max(0, parseInt(this.dhxcont.mainCont.style.height)-menuOffset-toolbarOffset-statusOffset)+"px";}
 
 this.obj.attachToolbar = function() {var toolbarObj = document.createElement("DIV");toolbarObj.style.position = "relative";toolbarObj.style.overflow = "hidden";toolbarObj.id = "dhxtoolbar_"+this._genStr(12);this.dhxcont.insertBefore(toolbarObj, this.dhxcont.childNodes[(this.menu!=null?1:0)]);this.toolbar = new dhtmlXToolbarObject(toolbarObj.id, this.skin);if (that.skin == "dhx_web"){this.toolbarHeight = 32;this.dhxcont.className = "dhtmlx_editor_extended_"+that.skin;}else if (that.skin == "dhx_terrace"){if (this._attached){this.toolbarHeight = 46;toolbarObj.style.marginBottom = "14px";}else {this.toolbarHeight = 34;toolbarObj.style.marginTop = "2px";toolbarObj.style.marginLeft = "2px";toolbarObj.style.marginBottom = "2px";}
 this.dhxcont.className = "dhtmlx_editor_extended_"+that.skin;}else {this.toolbarHeight = toolbarObj.offsetHeight+(this._isLayout&&this.skin=="dhx_skyblue"?2:0);}
 this.toolbarId = toolbarObj.id;if (this._doOnAttachToolbar)this._doOnAttachToolbar("init");this.adjust();return this.toolbar;}
 
 this.obj.attachObject = function(obj, autoSize) {if (typeof(obj)== "string") obj = document.getElementById(obj);if (autoSize){obj.style.visibility = "hidden";obj.style.display = "";var objW = obj.offsetWidth;var objH = obj.offsetHeight;}
 this._attachContent("obj", obj);if (autoSize && this._isWindow){obj.style.visibility = "visible";this._adjustToContent(objW, objH);}
 }
 this.obj.adjust = function() {if (this.skin == "dhx_skyblue"){if (this.toolbar){if (this._isWindow || this._isLayout){document.getElementById(this.toolbarId).style.height = "29px";this.toolbarHeight = document.getElementById(this.toolbarId).offsetHeight;if (this._doOnAttachToolbar)this._doOnAttachToolbar("show");}
 if (this._isCell){document.getElementById(this.toolbarId).className += " in_layoutcell";}
 if (this._isAcc){document.getElementById(this.toolbarId).className += " in_acccell";}
 }
 }
 }
 
 this.obj._attachContent = function(type, obj, append) {while (that.dhxcont.mainCont.childNodes.length > 0){that.dhxcont.mainCont.removeChild(that.dhxcont.mainCont.childNodes[0]);}
 
 if (type == "obj"){if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue"){this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";this.dhxcont.mainCont.style.backgroundColor = "#FFFFFF";this._redraw();}
 that.dhxcont._frame = null;that.dhxcont.mainCont.appendChild(obj);that.dhxcont.mainCont.style.overflow = (append===true?"auto":"hidden");obj.style.display = "";}
 }
 
 this.obj._dhxContDestruct = function() {while (this.dhxcont.mainCont.childNodes.length > 0)this.dhxcont.mainCont.removeChild(this.dhxcont.mainCont.childNodes[0]);this.dhxcont.mainCont.innerHTML = "";this.dhxcont.mainCont = null;try {delete this.dhxcont["mainCont"];}catch(e){};while (this.dhxcont.childNodes.length > 0)this.dhxcont.removeChild(this.dhxcont.childNodes[0]);this.dhxcont.innerHTML = "";this.dhxcont = null;try {delete this["dhxcont"];}catch(e){};this._genStr = null;this._attachContent = null;this._dhxContDestruct = null;this.adjust = null;this.attachObject = null;this.moveContentTo = null;this.adjustContent = null;this.attachToolbar = null;}
 
}
(function(){dhtmlx.extend_api("dhtmlXEditor",{_init:function(obj){return [obj.parent, obj.skin ];},
 content:"setContent"
 },{});})();dhtmlXEditor.prototype.unload = function() {if (!this._isToolbar){while (this.base.childNodes[0].childNodes.length > 0){if (this.base.childNodes[0].childNodes[0].tagName && String(this.base.childNodes[0].childNodes[0].tagName).toLowerCase() == "a") {this.base.childNodes[0].childNodes[0].childNodes[0].onclick = null;this.base.childNodes[0].childNodes[0].childNodes[0].onmousedown = null;this.base.childNodes[0].childNodes[0].removeChild(this.base.childNodes[0].childNodes[0].childNodes[0]);}
 this.base.childNodes[0].removeChild(this.base.childNodes[0].childNodes[0]);}
 }else {this._unloadExtModule();}
 
 this.base.childNodes[0].onselectstart = null;this.tbData = null;this.detachAllEvents();if (_isIE)this.editor.onreadystatechange = null;else this.editor.onload = null;this.editor.parentNode.removeChild(this.editor);this.editor.onunload = null;this.editor = null;this.edDoc = null;this.edWin = null;this.base._dhxContDestruct();this.base._idd = null;this.base.name = null;while (this.base.childNodes.length > 0)this.base.removeChild(this.base.childNodes[0]);this.base = null;this.cBlock = null;this._isToolbar = null;this._resizeTM = null;this._resizeTMTime = null;this.skin = null;this.iconsPath = null;this._ajaxOnLoad = null;this._ev = null;this._focus = null;this._prepareContent = null;this._doOnResize = null;this._doOnUnload = null;this.setIconsPath = null;this.init = null;this.setSizes = null;this.runCommand = null;this.applyBold = null;this.applyItalic = null;this.applyUnderscore = null;this.clearFormatting = null;this.attachEvent = null;this.callEvent = null;this.checkEvent = null;this.eventCatcher = null;this.detachEvent = null;this.detachAllEvents = null;this.showInfo = null;this.getSelectionBounds = null;this.getContent = null;this.setContent = null;this.setContentHTML = null;this.setReadonly = null;this.isReadonly = null;this.unload = null;};dhtmlXEditor.prototype.setReadonly = function(mode) {this._roMode = (mode===true);this._prepareContent(true, this._roMode);this.cBlock.style.display = (this._roMode?"":"none");};dhtmlXEditor.prototype.isReadonly = function(mode) {return (this._roMode||false);};dhtmlXEditor.prototype.initDhtmlxToolbar = function() {this.tb = this.base.attachToolbar();this.tb.setSkin(this.skin);if (this.skin == "dhx_skyblue"){this.tb.base.style.borderLeft = "none";this.tb.base.style.borderRight = "none";this.tb.base.style.top = "-1px";}
 this.setSizes();this.tb.setIconsPath(this.iconsPath+"dhxeditor_"+this.skin+"/");this._availFonts = new Array("Arial", "Arial Narrow", "Comic Sans MS", "Courier", "Georgia", "Impact", "Tahoma", "Times New Roman", "Verdana");this._initFont = this._availFonts[0];this._xmlFonts = "";for (var q=0;q<this._availFonts.length;q++){var fnt = String(this._availFonts[q]).replace(/\s/g,"_");this._xmlFonts += '<item type="button" id="applyFontFamily:'+fnt+'"><itemText><![CDATA[<img src="'+this.tb.imagePath+'font_'+String(fnt).toLowerCase()+'.gif" border="0" style="width:110px;height:16px;">]]></itemText></item>';}
 
 this._availSizes = {"1":"8pt", "2":"10pt", "3":"12pt", "4":"14pt", "5":"18pt", "6":"24pt", "7":"36pt"};this._xmlSizes = "";for (var a in this._availSizes){this._xmlSizes += '<item type="button" id="applyFontSize:'+a+':'+this._availSizes[a]+'" text="'+this._availSizes[a]+'"/>';}
 this.tbXML = '<toolbar>'+
 
 '<item id="applyH1" type="buttonTwoState" img="h1.gif" imgdis="h4_dis.gif" title="H1"/>'+
 '<item id="applyH2" type="buttonTwoState" img="h2.gif" imgdis="h4_dis.gif" title="H2"/>'+
 '<item id="applyH3" type="buttonTwoState" img="h3.gif" imgdis="h4_dis.gif" title="H3"/>'+
 '<item id="applyH4" type="buttonTwoState" img="h4.gif" imgdis="h4_dis.gif" title="H4"/>'+
 '<item id="separ01" type="separator"/>'+
 
 '<item id="applyBold" type="buttonTwoState" img="bold.gif" imgdis="bold_dis.gif" title="Bold Text"/>'+
 '<item id="applyItalic" type="buttonTwoState" img="italic.gif" imgdis="italic_dis.gif" title="Italic Text"/>'+
 '<item id="applyUnderscore" type="buttonTwoState" img="underline.gif" imgdis="underline_dis.gif" title="Underscore Text"/>'+
 '<item id="applyStrikethrough" type="buttonTwoState" img="strike.gif" imgdis="strike_dis.gif" title="Strikethrough Text"/>'+
 '<item id="separ02" type="separator"/>'+
 
 '<item id="alignLeft" type="buttonTwoState" img="align_left.gif" imgdis="align_left_dis.gif" title="Left Alignment"/>'+
 '<item id="alignCenter" type="buttonTwoState" img="align_center.gif" imgdis="align_center_dis.gif" title="Center Alignment"/>'+
 '<item id="alignRight" type="buttonTwoState" img="align_right.gif" imgdis="align_right_dis.gif" title="Right Alignment"/>'+
 '<item id="alignJustify" type="buttonTwoState" img="align_justify.gif" title="Justified Alignment"/>'+
 '<item id="separ03" type="separator"/>'+
 
 '<item id="applySub" type="buttonTwoState" img="script_sub.gif" imgdis="script_sub.gif" title="Subscript"/>'+
 '<item id="applySuper" type="buttonTwoState" img="script_super.gif" imgdis="script_super_dis.gif" title="Superscript"/>'+
 '<item id="separ04" type="separator"/>'+
 
 '<item id="createNumList" type="button" img="list_number.gif" imgdis="list_number_dis.gif" title="Number List"/>'+
 '<item id="createBulList" type="button" img="list_bullet.gif" imgdis="list_bullet_dis.gif" title="Bullet List"/>'+
 '<item id="separ05" type="separator"/>'+
 
 '<item id="increaseIndent" type="button" img="indent_inc.gif" imgdis="indent_inc_dis.gif" title="Increase Indent"/>'+
 '<item id="decreaseIndent" type="button" img="indent_dec.gif" imgdis="indent_dec_dis.gif" title="Decrease Indent"/>'+
 '<item id="separ06" type="separator"/>'+
 '<item id="clearFormatting" type="button" img="clear.gif" title="Clear Formatting"/>'+
 '</toolbar>';this.tb.loadXMLString(this.tbXML);this._checkAlign = function(alignSelected) {this.tb.setItemState("alignCenter", false);this.tb.setItemState("alignRight", false);this.tb.setItemState("alignJustify", false);this.tb.setItemState("alignLeft", false);if (alignSelected)this.tb.setItemState(alignSelected, true);}
 
 this._checkH = function(h) {this.tb.setItemState("applyH1", false);this.tb.setItemState("applyH2", false);this.tb.setItemState("applyH3", false);this.tb.setItemState("applyH4", false);if (h)this.tb.setItemState(h, true);}
 
 this._doOnFocusChanged = function(state) {if(!state.h1&&!state.h2&&!state.h3&&!state.h4){var bold = (String(state.fontWeight).search(/bold/i) != -1) || (Number(state.fontWeight) >= 700);this.tb.setItemState("applyBold", bold);}else this.tb.setItemState("applyBold", false);var alignId = "alignLeft";if (String(state.textAlign).search(/center/) != -1) {alignId = "alignCenter";}
 if (String(state.textAlign).search(/right/) != -1) {alignId = "alignRight";}
 if (String(state.textAlign).search(/justify/) != -1) {alignId = "alignJustify";}
 this.tb.setItemState(alignId, true);this._checkAlign(alignId);this.tb.setItemState("applyH1", state.h1);this.tb.setItemState("applyH2", state.h2);this.tb.setItemState("applyH3", state.h3);this.tb.setItemState("applyH4", state.h4);if (window._KHTMLrv){state.sub = (state.vAlign == "sub");state.sup = (state.vAlign == "super");}
 this.tb.setItemState("applyItalic", (state.fontStyle == "italic"));this.tb.setItemState("applyStrikethrough", state.del);this.tb.setItemState("applySub", state.sub);this.tb.setItemState("applySuper", state.sup);this.tb.setItemState("applyUnderscore", state.u);}
 
 this._doOnToolbarClick = function(id) {var action = String(id).split(":");if (this[action[0]] != null){if (typeof(this[action[0]])== "function") {this[action[0]](action[1]);this.callEvent("onToolbarClick",[id]);}
 }
 }
 
 this._doOnStateChange = function(itemId, state) {this[itemId]();switch (itemId) {case "alignLeft":
 case "alignCenter":
 case "alignRight":
 case "alignJustify":
 this._checkAlign(itemId);break;case "applyH1":
 case "applyH2":
 case "applyH3":
 case "applyH4":
 this._checkH(itemId);break;}
 this.callEvent("onToolbarClick",[itemId]);}
 this._doOnBeforeStateChange = function(itemId, state) {if ((itemId == "alignLeft" || itemId == "alignCenter" || itemId == "alignRight" || itemId == "alignJustify")&& state == true) {return false;}
 return true;}
 var that = this;this.tb.attachEvent("onClick", function(id){that._doOnToolbarClick(id);});this.tb.attachEvent("onStateChange", function(id,st){that._doOnStateChange(id,st);});this.tb.attachEvent("onBeforeStateChange", function(id,st){return that._doOnBeforeStateChange(id,st);});this.applyBold = function(){this.runCommand("Bold");}
 
 this.applyItalic = function(){this.runCommand("Italic");}
 
 this.applyUnderscore = function(){this.runCommand("Underline");}
 
 this.applyStrikethrough = function(){this.runCommand("StrikeThrough");}
 
 this.alignLeft = function(){this.runCommand("JustifyLeft");}
 
 this.alignRight = function(){this.runCommand("JustifyRight");}
 
 this.alignCenter = function(){this.runCommand("JustifyCenter");}
 
 this.alignJustify = function(){this.runCommand("JustifyFull");}
 
 this.applySub = function(){this.runCommand("Subscript");}
 
 this.applySuper = function(){this.runCommand("Superscript");}
 
 this.applyH1 = function(){this.runCommand("FormatBlock","<H1>");}
 
 this.applyH2 = function(){this.runCommand("FormatBlock","<H2>");}
 
 this.applyH3 = function(){this.runCommand("FormatBlock","<H3>");}
 
 this.applyH4 = function(){this.runCommand("FormatBlock","<H4>");}
 
 this.createNumList = function(){this.runCommand("InsertOrderedList");}
 
 this.createBulList = function(){this.runCommand("InsertUnorderedList");}
 
 this.increaseIndent = function(){this.runCommand("Indent");}
 
 this.decreaseIndent = function(){this.runCommand("Outdent");}
 this.clearFormatting = function() {this.runCommand("RemoveFormat");this.tb.setItemState("applyBold", false);this.tb.setItemState("applyItalic", false);this.tb.setItemState("applyStrikethrough", false);this.tb.setItemState("applySub", false);this.tb.setItemState("applySuper", false);this.tb.setItemState("applyUnderscore", false);}
 
 
 
 this.getParentByTag = function(node, tag_name){tag_name = tag_name.toLowerCase()
 var p = node
 do{if(tag_name == '' || p.nodeName.toLowerCase()== tag_name) return p
 }while(p = p.parentNode)return node
 }
 
 this.isStyleProperty = function(node, tag_name, name, value){tag_name = tag_name.toLowerCase();var n = node;do{if((n.nodeName.toLowerCase()== tag_name)&&(n.style[name]==value)) return true
 }while(n = n.parentNode)return false
 }
 
 this.setStyleProperty = function(el,prop){this.style[prop] = false;var n = this.getParentByTag(el,prop);if(n&&(n.tagName.toLowerCase()==prop)) this.style[prop] = true;if(prop == "del")if(this.getParentByTag(el,"strike")&&(this.getParentByTag(el,"strike").tagName.toLowerCase()=="strike")) this.style.del = true;}
 
 
 this._unloadExtModule = function() {this.tb.unload();this.tb = null;this._availFonts = null;this._initFont = null;this._xmlFonts = null;this._availSizes = null;this._xmlSizes = null;this.tbXML = null;this._checkAlign = null;this._checkH = null;this._doOnFocusChanged = null;this._doOnToolbarClick = null;this._doOnStateChange = null;this._doOnBeforeStateChange = null;this.applyBold = null;this.applyItalic = null;this.applyUnderscore = null;this.applyStrikethrough = null;this.alignLeft = null;this.alignRight = null;this.alignCenter = null;this.alignJustify = null;this.applySub = null;this.applySuper = null;this.applyH1 = null;this.applyH2 = null;this.applyH3 = null;this.applyH4 = null;this.createNumList = null;this.createBulList = null;this.increaseIndent = null;this.decreaseIndent = null;this.clearFormatting = null;this.getParentByTag = null;this.isStyleProperty = null;this.setStyleProperty = null;}
}
function dhtmlXForm(parentObj, data) {this.i = {position: "label-left",
 labelWidth: "auto",
 labelHeight: "auto",
 inputWidth: "auto",
 inputHeight: "auto",
 labelAlign: "left",
 noteWidth: "auto",
 offsetTop: 0,
 offsetLeft: 0
 };this.apos_css = {"label-left": "dhxform_item_label_left",
 "label-right": "dhxform_item_label_right",
 "label-top": "dhxform_item_label_top",
 "label-bottom": "dhxform_item_label_bottom", 
 "absolute": "dhxform_item_absolute"
 }
 this.align_css = {left: "dhxform_label_align_left",
 center: "dhxform_label_align_center",
 right: "dhxform_label_align_right"
 }
 
 var that = this;this.skin = (typeof(dhtmlx)!="undefined"?dhtmlx.skin||"dhx_skyblue":"dhx_skyblue");this.setSkin = function(skin) {this.skin = skin;this.cont.className = "dhxform_obj_"+this.skin;this.cont.style.fontSize = "13px";this._updateBlocks();this.forEachItem(function(id){if(that.getItemType(id)=="calendar"){that.doWithItem(id,"setSkin",skin);}});}
 
 this.separator = ",";this.live_validate = false;this._type = "checkbox";this._rGroup = "default";this._idIndex = {};this._indexId = [];this.cont = (typeof(parentObj)=="object"?parentObj:document.getElementById(parentObj));if (!parentObj._isNestedForm){this._parentForm = true;this.cont.style.fontSize = "13px";this.cont.className = "dhxform_obj_"+this.skin;this.setFontSize = function(fs) {this.cont.style.fontSize = fs;this._updateBlocks();}
 
 this.getForm = function() {return this;}
 
 this.cont.onkeypress = function(e) {e = (e||event);if (e.keyCode == 13){var t = (e.target||e.srcElement);if (typeof(t.tagName)!= "undefined" && String(t.tagName).toLowerCase() == "textarea" && !e.ctrlKey) return;that.callEvent("onEnter",[]);}
 }
 
 }
 
 this.b_index = null;this.base = [];this._prepare = function(ofsLeft) {if (this.b_index == null)this.b_index = 0;else this.b_index++;this.base[this.b_index] = document.createElement("DIV");this.base[this.b_index].className = "dhxform_base";if (typeof(ofsLeft)!= "undefined") this.base[this.b_index].style.cssText += " margin-left:"+ofsLeft+"px!important;";this.cont.appendChild(this.base[this.b_index]);}
 
 
 this.setSizes = function() {}
 
 this._mergeSettings = function(data) {var u = -1;var i = {type: "settings"};for (var a in this.i)i[a] = this.i[a];for (var q=0;q<data.length;q++){if (typeof(data[q])!= "undefined" && data[q].type == "settings") {for (var a in data[q])i[a] = data[q][a];u = q;}
 }
 data[u>=0?u:data.length] = i;return data;}
 
 this._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 
 this.idPrefix = "dhxForm_"+this._genStr(12)+"_";this._rId = (this._parentForm?this._genStr(12)+"_":parentObj._rId);this.objPull = {};this.itemPull = {};this._ic = 0;this._addItem = function(type, id, data, sId, lp) {if (this.items[type]._index){this.getForm()._indexId.push(id);this.getForm()._idIndex[id] = {ind: this.getForm()._indexId.length-1};this.getForm()._idIndex[id] = {ind: this.getForm()._indexId.length-1};}
 
 if (!type)type = this._type;if (type == "list" && ({"fieldset":true,"block":true})[this.getItemType(lp)] == true) {var tr = this.itemPull[this.idPrefix+lp]._addSubListNode();}else {if (type == "newcolumn"){var tr = {};}else {var tr = document.createElement("DIV");this.base[this.b_index].appendChild(tr);}
 }
 
 tr._idd = id;tr._rId = this._rId;if (typeof(tr.style)!= "undefined") {if (typeof(data.offsetLeft)== "undefined" && this.i.offsetLeft > 0) data.offsetLeft = this.i.offsetLeft;if (typeof(data.offsetTop)== "undefined" && this.i.offsetTop > 0) data.offsetTop = this.i.offsetTop;if (typeof(data.offsetLeft)!= "undefined") tr.style.cssText += " padding-left:"+data.offsetLeft+"px!important;";if (typeof(data.offsetTop)!= "undefined") tr.style.cssText += " padding-top:"+data.offsetTop+"px!important;";}
 
 if (type == "list"){if (sId != null)tr._sId = sId;var listData = this.items[type].render(tr);if (!this.itemPull[this.idPrefix+id]._listObj)this.itemPull[this.idPrefix+id]._listObj = [];if (!this.itemPull[this.idPrefix+id]._list)this.itemPull[this.idPrefix+id]._list = [];if (!this.itemPull[this.idPrefix+id]._listBase)this.itemPull[this.idPrefix+id]._listBase = [];(this.itemPull[this.idPrefix+id]._listObj).push(listData[0]);(this.itemPull[this.idPrefix+id]._list).push(listData[1]);(this.itemPull[this.idPrefix+id]._listBase).push(tr);listData[1].checkEvent = function(evName) {return that.checkEvent(evName);}
 listData[1].callEvent = function(evName, evData) {return that.callEvent(evName, evData);}
 listData[1].getForm = function() {return that.getForm();}
 listData[1]._initObj(this._mergeSettings(data));if (tr._inBlcok)tr.className += " in_block";return listData[1];}
 
 if (type == "newcolumn"){this._prepare(data.offset);return;}
 
 if (({input:true,fieldset:true,block:true,password:true,calendar:true,colorpicker:true})[type] !== true) tr.onselectstart = function(e){e=e||event;e.returnValue=false;return false;}
 
 if (type == "label" && this._ic++ == 0)data._isTopmost = true;if (type == "select" && this.skin == "dhx_terrace")tr._inpWidthFix=6;data.position = this.apos_css[(!data.position||!this.apos_css[data.position]?this.i.position:data.position)];tr.className = data.position+(typeof(data.className)=="string"?" "+data.className:"");if (!data.labelWidth)data.labelWidth = this.i.labelWidth;if (!data.labelHeight)data.labelHeight = this.i.labelHeight;if (typeof(data.wrap)!= "undefined") data.wrap = this._s2b(data.wrap);data.labelAlign = (this.align_css[data.labelAlign]?this.align_css[data.labelAlign]:this.align_css[this.i.labelAlign]);data.inputWidth = (data.width?data.width:(data.inputWidth?data.inputWidth:this.i.inputWidth));if (!data.inputHeight)data.inputHeight = this.i.inputHeight;if (typeof(data.note)!= "undefined") {if (data.note.length != null && data.note[0] != null)data.note = data.note[0];if (typeof(data.note.width)== "undefined") data.note.width = this.i.noteWidth;if (data.note.width == "auto")data.note.width = data.inputWidth;}
 
 tr.checkEvent = function(evName) {return that.checkEvent(evName);}
 tr.callEvent = function(evName, evData) {return that.callEvent(evName, evData);}
 tr.getForm = function() {return that.getForm();}
 tr._autoCheck = function(t) {that._autoCheck(t);}
 
 
 if (typeof(data.readonly)== "string") data.readonly = this._s2b(data.readonly);if (typeof(data.autoStart)== "string") data.autoStart = this._s2b(data.autoStart);if (typeof(data.autoRemove)== "string") data.autoRemove = this._s2b(data.autoRemove);if (typeof(data.titleScreen)== "string") data.titleScreen = this._s2b(data.titleScreen);if (typeof(data.info)== "string") data.info = this._s2b(data.info);if (typeof(data.userdata)!= "undefined") {for (var a in data.userdata)this.getForm().setUserData(id,a,data.userdata[a]);}
 
 
 if (data.validate){if (typeof(data.validate != "undefined")&& (typeof(data.validate) == "function" || typeof(window[data.validate]) == "function")) {tr._validate = [data.validate];}else {tr._validate = String(data.validate).split(this.separator);}
 }
 if (typeof(data.required)!= "undefined") {if (typeof(data.required)== "string") data.required = this._s2b(data.required);tr._required = (data.required==true);}
 if (tr._required){if (!tr._validate)tr._validate = [];var p = false;for (q=0;q<tr._validate.length;q++)p = (p||(tr._validate[q]=="NotEmpty"));if (!p)tr._validate.push("NotEmpty");}
 
 tr._ll = (data.position == this.apos_css["label-left"] || data.position == this.apos_css["label-top"]);this.objPull[this.idPrefix+id] = this.items[type].render(tr, data);this.itemPull[this.idPrefix+id] = tr;}
 
 
 
 this._initObj = function(data) {this._prepare();for (var q=0;q<data.length;q++){if (typeof(data[q])!= "undefined" && data[q].type == "settings") for (var a in data[q])this.i[a] = data[q][a];}
 
 for (var q=0;q<data.length;q++){if (typeof(data[q])!= "undefined") {var type = (data[q].type||"");if (this.items[type]){if (!data[q].name)data[q].name = this._genStr(12);var id = data[q].name;if (this.objPull[this.idPrefix+id] != null || type=="radio")id = this._genStr(12);var obj = data[q];obj.label = obj.label||"";obj.value = obj.value;obj.checked = !!obj.checked;obj.disabled = !!obj.disabled;obj.name = obj.name||this._genStr(12);obj.options = obj.options||[];obj.rows = obj.rows||"none";obj.uid = this._genStr(12);this._addItem(type, id, obj);if (this._parentEnabled === false)this._disableItem(id);for (var w=0;w<obj.options.length;w++){if (obj.options[w].list != null){if (!obj.options[w].value)obj.options[w].value = this._genStr();var subList = this._addItem("list", id, obj.options[w].list, obj.options[w].value);subList._subSelect = true;subList._subSelectId = obj.options[w].value;}
 }
 
 
 if (data[q].list != null){if (!data[q].listParent)data[q].listParent = obj.name;var subList = this._addItem("list", id, data[q].list, null, data[q].listParent);}
 }
 }
 }
 this._autoCheck();}
 
 
 
 this._s2b = function(r) {if (r == "true" || r == "1" || r == "yes" || r == true)return true;return false;}
 
 this._xmlSubItems = {item: "list", option: "options", note: "note", userdata: "_userdata"};this._xmlToObject = function(xmlData, rootLevel) {var data = (rootLevel?[]:{});for (var q=0;q<xmlData.childNodes.length;q++){if (typeof(xmlData.childNodes[q].tagName)!= "undefined") {var tg = xmlData.childNodes[q].tagName;if (this._xmlSubItems[tg] != null){var node = this._xmlSubItems[tg];if (typeof(data[node])== "undefined") data[node] = [];var k = {};for (var w=0;w<xmlData.childNodes[q].attributes.length;w++){var attrName = xmlData.childNodes[q].attributes[w].name;var attrValue = xmlData.childNodes[q].attributes[w].value;k[attrName] = attrValue;}
 
 
 if (node == "note")k.text = xmlData.childNodes[q].firstChild.nodeValue;if (node == "_userdata")k.value = xmlData.childNodes[q].firstChild.nodeValue;var data2 = this._xmlToObject(xmlData.childNodes[q]);for (var a in data2){if (a == "_userdata"){if (!k.userdata)k.userdata = {};for (var w=0;w<data2[a].length;w++)k.userdata[data2[a][w].name] = data2[a][w].value;}else {k[a] = data2[a];}
 }
 
 if (rootLevel)data.push(k);else data[node].push(k);}
 
 }
 
 
 }
 
 return data;}
 
 this._xmlParser = function() {if (that._loadType == "json"){eval("var formJSONData="+this.xmlDoc.responseText);if (typeof(formJSONData)== "object" && formJSONData != null) that._initObj(formJSONData);}else {var t = that._xmlToObject(this.getXMLTopNode("items"), true);that._initObj(t);}
 if (that.cont && that.cont.cmp && that.cont.cmp == "form")that.setSizes();that.callEvent("onXLE",[]);if (typeof(that._doOnLoad)== "function") that._doOnLoad();}
 
 this._doOnLoad = null;this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this.loadStruct = function(a,b,c) {this._loadType = "xml";if (typeof(b)== "string") {if (b.toLowerCase()== "json") {this._loadType = "json";if (typeof(a)!= "string") {this._initObj(a);return;}
 }
 this._doOnLoad = (c||null);}else {this._doOnLoad = (b||null);}
 this.callEvent("onXLS", []);this._xmlLoader.loadXML(a);}
 this.loadStructString = function(xmlString, onLoadFunction) {this._doOnLoad = (onLoadFunction||null);this._xmlLoader.loadXMLString(xmlString);}
 
 
 
 this._autoCheck = function(enabled) {if (this._locked === true){enabled = false;}else {if (typeof(enabled)== "undefined") enabled = true;}
 for (var a in this.itemPull){var isEnabled = (enabled&&(this.itemPull[a]._udis!==true));this[isEnabled?"_enableItem":"_disableItem"](this.itemPull[a]._idd);if (this.getForm()._idIndex[this.itemPull[a]._idd] != null) {this.getForm()._idIndex[this.itemPull[a]._idd].enabled = isEnabled;}
 
 
 var pEnabled = (isEnabled&&(typeof(this.itemPull[a]._checked)=="boolean"?this.itemPull[a]._checked:true));if (this.itemPull[a]._list){for (var q=0;q<this.itemPull[a]._list.length;q++){var f = true;if (this.itemPull[a]._list[q]._subSelect == true){f = false
 var v = this.getItemValue(this.itemPull[a]._idd);if (!(typeof(v)== "object" && typeof(v.length) == "number")) v = [v];for (var w=0;w<v.length;w++)f = (v[w]==this.itemPull[a]._list[q]._subSelectId)||f;this.itemPull[a]._listObj[q][f?"show":"hide"](this.itemPull[a]._listBase[q]);}
 this.itemPull[a]._list[q]._autoCheck(pEnabled&&f);}
 }
 }
 }
 
 
 
 this.doWithItem = function(id, method, a, b, c, d) {if (typeof(id)== "object") {var group = id[0];var value = id[1];var item = null;var res = null;for (var k in this.itemPull){if ((this.itemPull[k]._value == value || value === null)&& this.itemPull[k]._group == group) return this.objPull[k][method](this.itemPull[k], a, b, c, d);if (this.itemPull[k]._list != null && !res){for (var q=0;q<this.itemPull[k]._list.length;q++){res = this.itemPull[k]._list[q].doWithItem(id, method, a, b, c);}
 }
 }
 if (res != null){return res;}else {if (method == "getType")return this.doWithItem(id[0], "getType");}
 
 }else {if (!this.itemPull[this.idPrefix+id]){var res = null;for (var k in this.itemPull){if (this.itemPull[k]._list && !res){for (var q=0;q<this.itemPull[k]._list.length;q++){if (res == null)res = this.itemPull[k]._list[q].doWithItem(id, method, a, b, c, d);}
 }
 }
 return res;}else {return this.objPull[this.idPrefix+id][method](this.itemPull[this.idPrefix+id], a, b, c, d);}
 }
 }
 
 this.removeItem = function(id, value) {if (value != null)id = this.doWithItem([id, value], "destruct");else this.doWithItem(id, "destruct");this._clearItemData(id);}
 
 this._clearItemData = function(id) {if (this.itemPull[this.idPrefix+id]){id = this.idPrefix+id;try {this.objPull[id] = null;this.itemPull[id] = null;delete this.objPull[id];delete this.itemPull[id];}catch(e) {}
 }else {for (var k in this.itemPull){if (this.itemPull[k]._list){for (var q=0;q<this.itemPull[k]._list.length;q++)this.itemPull[k]._list[q]._clearItemData(id);}
 }
 }
 }
 
 this.isItem = function(id, value) {if (value != null)id = [id, value];return this.doWithItem(id, "isExist");}
 
 this.getItemType = function(id, value) {id = [id, (value||null)];return this.doWithItem(id, "getType");}
 
 this.getItemsList = function() {var list = [];var exist = [];for (var a in this.itemPull){var id = null;if (this.itemPull[a]._group){id = this.itemPull[a]._group;}else {id = a.replace(this.idPrefix, "");}
 if (exist[id] != true)list.push(id);exist[id] = true;}
 return list;}
 
 
 this.forEachItem = function(handler) {for (var a in this.objPull){handler(String(a).replace(this.idPrefix,""));if (this.itemPull[a]._list){for (var q=0;q<this.itemPull[a]._list.length;q++)this.itemPull[a]._list[q].forEachItem(handler);}
 }
 }
 
 
 this.setItemLabel = function(id, value, text) {if (text != null)id = [id, value];else text = value;this.doWithItem(id, "setText", text);}
 
 this.getItemLabel = function(id, value) {if (value != null)id = [id, value];return this.doWithItem(id, "getText");}
 
 this.setItemText = this.setItemLabel;this.getItemText = this.getItemLabel;this._enableItem = function(id) {this.doWithItem(id, "enable");}
 
 this._disableItem = function(id) {this.doWithItem(id, "disable");}
 
 this._isItemEnabled = function(id) {return this.doWithItem(id, "isEnabled");}
 
 
 this.checkItem = function(id, value) {if (value != null)id = [id, value];this.doWithItem(id, "check");this._autoCheck();}
 
 this.uncheckItem = function(id, value) {if (value != null)id = [id, value];this.doWithItem(id, "unCheck");this._autoCheck();}
 
 this.isItemChecked = function(id, value) {if (value != null)id = [id, value];return this.doWithItem(id, "isChecked");}
 
 this.getCheckedValue = function(id) {return this.doWithItem([id, null], "getChecked");}
 
 
 
 
 this._getRGroup = function(id, val) {for (var a in this.itemPull){if (this.itemPull[a]._group == id && (val == null || this.itemPull[a]._value == val)) return this.itemPull[a]._idd;if (this.itemPull[a]._list != null){for (var q=0;q<this.itemPull[a]._list.length;q++){var r = this.itemPull[a]._list[q]._getRGroup(id, val);if (r != null)return r;}
 }
 }
 return null;}
 
 this.setItemValue = function(id, value) {if (this.getItemType(id)== "radio") {if (this._getRGroup(id, value)!= null) this.checkItem(id, value);else this.uncheckItem(id, this.getCheckedValue(id));return null;}
 return this.doWithItem(id, "setValue", value);}
 
 this.getItemValue = function(id, param) {this._updateValues();if (this.getItemType(id)== "radio") return this.getCheckedValue(id);return this.doWithItem(id, "getValue", param);}
 
 this.updateValues = function() {this._updateValues();}
 
 
 this.showItem = function(id, value) {if (value != null)id = [id,value];this.doWithItem(id, "show");}
 
 this.hideItem = function(id, value) {if (value != null)id = [id,value];this.doWithItem(id, "hide");}
 
 this.isItemHidden = function(id, value) {if (value != null)id = [id,value];return this.doWithItem(id, "isHidden");}
 
 
 this.getOptions = function(id) {return this.doWithItem(id, "getOptions");}
 
 
 this.setItemWidth = function(id, width) {this.doWithItem(id, "setWidth", width);}
 
 this.getItemWidth = function(id) {return this.doWithItem(id, "getWidth");}
 
 this.setItemHeight = function(id, height) {this.doWithItem(id, "setHeight", height);}
 
 this.setItemFocus = function(id) {this.doWithItem(id, "setFocus");}
 
 
 
 
 
 this._updateValues = function() {for (var a in this.itemPull){if (this.objPull[a] && typeof(this.objPull[a].updateValue)== "function") {this.objPull[a].updateValue(this.itemPull[a]);}
 if (this.itemPull[a]._list){for (var q=0;q<this.itemPull[a]._list.length;q++){this.itemPull[a]._list[q]._updateValues();}
 }
 }
 }
 
 
 this._getItemByName = function(id) {for (var a in this.itemPull){if (this.itemPull[a]._idd == id)return this.itemPull[a];if (this.itemPull[a]._list != null){for (var q=0;q<this.itemPull[a]._list.length;q++){var r = this.itemPull[a]._list[q]._getItemByName(id);if (r != null)return r;}
 }
 }
 return null;}
 this._resetValidateCss = function(item) {item.className = (item.className).replace(item._vcss,"");item._vcss = null;}
 this.setValidateCss = function(name, state, custom) {var item = this[this.getItemType(name)=="radio"?"_getRGroup":"_getItemByName"](name);if (!item)return;if (item._vcss != null)this._resetValidateCss(item);item._vcss = (typeof(custom)=="string"?custom:"validate_"+(state===true?"ok":"error"));item.className += " "+item._vcss;}
 this.resetValidateCss = function(name) {for (var a in this.itemPull){if (this.itemPull[a]._vcss != null)this._resetValidateCss(this.itemPull[a]);if (this.itemPull[a]._list != null){for (var q=0;q<this.itemPull[a]._list.length;q++)this.itemPull[a]._list[q].resetValidateCss();}
 }
 }
 
 this.validate = function(type) {this._updateValues();if (this.callEvent("onBeforeValidate",[])== false) return;var completed = true;this.forEachItem(function(name){completed = that.doWithItem(name,"_validate") && completed;});this.callEvent("onAfterValidate",[completed]);return completed;}
 
 this.validateItem = function(name) {return this.doWithItem(name,"_validate");}
 
 this.enableLiveValidation = function(state) {this.live_validate = (state==true);}
 
 
 
 
 this.setReadonly = function(id, state) {this.doWithItem(id, "setReadonly", state);}
 
 this.isReadonly = function(id) {return this.doWithItem(id, "isReadonly");}
 
 
 
 this.getFirstActive = function(withFocus) {for (var q=0;q<this._indexId.length;q++){var k = true;if (withFocus == true){var t = this.getItemType(this._indexId[q]);if (!dhtmlXForm.prototype.items[t].setFocus)k = false;}
 if (k && this._idIndex[this._indexId[q]].enabled)return this._indexId[q];}
 return null;}
 
 this.setFocusOnFirstActive = function() {var k = this.getFirstActive(true);if (k != null)this.setItemFocus(k);}
 
 
 
 this.enableItem = function(id, value) {if (value != null)id = [id,value];this.doWithItem(id, "userEnable");this._autoCheck();}
 
 this.disableItem = function(id, value) {if (value != null)id = [id,value];this.doWithItem(id, "userDisable");this._autoCheck();}
 
 this.isItemEnabled = function(id, value) {if (value != null)id = [id,value];return this.doWithItem(id, "isUserEnabled");}
 
 this.clear = function() {var usedRAs = {};this.formId = (new Date()).valueOf();this.resetDataProcessor("inserted");for (var a in this.itemPull){var t = this.itemPull[a]._idd;if (this.itemPull[a]._type == "ch")this.uncheckItem(t);if (this.itemPull[a]._type in {"ta":1,"editor":1,"calendar":1,"pw":1,"hd":1})this.setItemValue(t, "");if (this.itemPull[a]._type == "combo")(this.getCombo(t)).selectOption(0);if (this.itemPull[a]._type == "se"){var opts = this.getOptions(t);if (opts.length > 0)opts[0].selected = true;}
 
 if (this.itemPull[a]._type == "ra"){var g = this.itemPull[a]._group;if (!usedRAs[g]){this.checkItem(g, this.doWithItem(t, "_getFirstValue"));usedRAs[g] = true;}
 }
 
 if (this.itemPull[a]._list)for (var q=0;q<this.itemPull[a]._list.length;q++)this.itemPull[a]._list[q].clear();}
 usedRAs = null;if (this._parentForm)this._autoCheck();this.resetValidateCss();}
 
 this.unload = function() {for (var a in this.objPull)this.removeItem(String(a).replace(this.idPrefix,""));this.detachAllEvents();if (this._ccTm)window.clearTimeout(this._ccTm);this._formLS = null;this._xmlLoader.destructor();this._xmlLoader = null;this._xmlParser = null;this._xmlToObject = null;this.loadXML = null;this.loadXMLString = null;this.items = null;this.objPull = null;this.itemPull = null;this._addItem = null;this._genStr = null;this._initObj = null;this._autoCheck = null;this._clearItemData = null;this._enableItem = null;this._disableItem = null;this._isItemEnabled = null;this.forEachItem = null;this.isItem = null;this.clear = null;this.doWithItem = null;this.getItemType = null;this.removeItem = null;this.unload = null;this.getForm = null;this.attachEvent = null;this.callEvent = null;this.checkEvent = null;this.detachEvent = null;this.eventCatcher = null;this.setItemPosition = null;this.getItemPosition = null;this._setPosition = null;this._getPosition = null;this.setItemLabel = null;this.getItemLabel = null
 this.setItemText = null;this.getItemText = null;this.setItemValue = null;this.getItemValue = null;this.showItem = null;this.hideItem = null;this.isItemHidden = null;this.checkItem = null;this.uncheckItem = null;this.isItemChecked = null;this.getOptions = null;this._ic = null;this._ulToObject = null;this.loadStruct = null;this.loadStructString = null;this.remove = null;this.setFontSize = null;this.setItemHeight = null;this.setItemWidth = null;this.setSkin = null;this._rGroup = null;this._type = null;this._parentEnabled = null;this._parentForm = null;this._doLock = null;this._mergeSettings = null;this._locked = null;this._prepare = null;this.detachAllEvents = null;this.getCheckedValue = null;this.getItemWidth = null;this.setUserData = null;this.getUserData = null;this.setRTL = null;this.setSizes = null;this.getCalendar = null;this.getColorPicker = null;this.getCombo = null;this.getEditor = null;this.setFormData = null;this.getFormData = null;this.getItemsList = null;this.lock = null;this.unlock = null;this.isLocked = null;this.setReadonly = null;this.isReadonly = null;this.apos_css = null;this.align_css = null;this.b_index = null;this.i = null;this.skin = null;this.idPrefix = null;this._subSelect = null;this._subSelectId = null;for (var q=0;q<this.base.length;q++){while (this.base[q].childNodes.length > 0)this.base[q].removeChild(this.base[q].childNodes[0]);if (this.base[q].parentNode)this.base[q].parentNode.removeChild(this.base[q]);this.base[q] = null;}
 this.base = null;this.cont.onkeypress = null;this.cont.className = "";this.cont = null;}
 
 for (var a in this.items){this.items[a].t = a;if (typeof(this.items[a]._index)== "undefined") {this.items[a]._index = true;}
 
 if (!this.items[a].show){this.items[a].show = function(item) {item.style.display = "";if (item._listObj)for (var q=0;q<item._listObj.length;q++)item._listObj[q].show(item._listBase[q]);}
 }
 
 if (!this.items[a].hide){this.items[a].hide = function(item) {item.style.display = "none";if (item._listObj)for (var q=0;q<item._listObj.length;q++)item._listObj[q].hide(item._listBase[q]);}
 }
 
 if (!this.items[a].isHidden){this.items[a].isHidden = function(item) {return (item.style.display == "none");}
 }
 
 if (!this.items[a].userEnable){this.items[a].userEnable = function(item) {item._udis = false;}
 }
 
 if (!this.items[a].userDisable){this.items[a].userDisable = function(item) {item._udis = true;}
 }
 
 if (!this.items[a].isUserEnabled){this.items[a].isUserEnabled = function(item) {return (item._udis!==true);}
 }
 
 if (!this.items[a].getType){this.items[a].getType = function() {return this.t;}
 }
 
 if (!this.items[a].isExist){this.items[a].isExist = function() {return true;}
 }
 
 if (!this.items[a].validate){this.items[a]._validate = function(item) {if (!item._validate || !item._enabled)return true;if (item._type == "ch"){var val = (this.isChecked(item)?this.getValue(item):0);}else {var val = this.getValue(item);}
 
 var r = true;for (var q=0;q<item._validate.length;q++){var v = "is"+item._validate[q];if ((val == null || val.length == 0)&& v != "isNotEmpty") {}else {var f = dhtmlxValidation[v];if (typeof(f)!= "function" && typeof(item._validate[q]) == "function") f = item._validate[q];if (typeof(f)!= "function" && typeof(window[item._validate[q]]) == "function") f = window[item._validate[q]];r = ((typeof(f)=="function"?f(val):new RegExp(item._validate[q]).test(val)) && r);f = null;}
 }
 
 if (!(item.callEvent("onValidate"+(r?"Success":"Error"),[item._idd,val,r])===false)) item.getForm().setValidateCss(item._idd, r);return r;}
 }
 
 
 }
 
 
 this._locked = false;this._doLock = function(state) {var t = (state===true?true:false);if (this._locked == t)return;else this._locked = t;this._autoCheck(!this._locked);}
 this.lock = function() {this._doLock(true);}
 this.unlock = function() {this._doLock(false);}
 this.isLocked = function() {return this._locked;}
 
 
 this.setNumberFormat = function(id, format, g_sep, d_sep) {return this.doWithItem(id, "setNumberFormat", format, g_sep, d_sep);}
 
 
 dhtmlxEventable(this);this.attachEvent("_onButtonClick", function(name, cmd){this.callEvent("onButtonClick", [name, cmd]);});this._updateBlocks = function() {this.forEachItem(function(id){if (that.getItemType(id)== "block" || that.getItemType(id) == "combo") {that.doWithItem(id,"_setCss",that.skin,that.cont.style.fontSize);}
 });}
 
 
 this._isObj = function(k) {return (k != null && typeof(k) == "object" && typeof(k.length) == "undefined");}
 this._copyObj = function(r) {if (this._isObj(r)) {var t = {};for (var a in r){if (typeof(r[a])== "object" && r[a] != null) t[a] = this._copyObj(r[a]);else t[a] = r[a];}
 }else {var t = [];for (var a=0;a<r.length;a++){if (typeof(r[a])== "object" && r[a] != null) t[a] = this._copyObj(r[a]);else t[a] = r[a];}
 }
 return t;}
 
 
 if (data != null && typeof(data)== "object") {this._initObj(this._copyObj(data));};if (this._parentForm){this._updateBlocks();}
 
 
 this._ccActive = false;this._ccTm = null;this._ccActivate = function(id, inp, val) {if (!this._formLS)this._formLS = {};if (!this._formLS[id])this._formLS[id] = {input: inp, value: val};if (!this._ccActive){this._ccActive = true;this._ccDo();}
 inp = null;}
 
 this._ccDeactivate = function(id) {if (this._ccTm)window.clearTimeout(this._ccTm);this._ccActive = false;if (this._formLS != null && this._formLS[id] != null){this._formLS[id].input = null;this._formLS[id] = null;delete this._formLS[id];}
 }
 
 this._ccDo = function() {if (this._ccTm)window.clearTimeout(this._ccTm);for (var a in this._formLS){var inp = this._formLS[a].input;if (String(inp.tagName).toLowerCase() == "select") {var v = "";if (inp.selectedIndex >= 0 && inp.selectedIndex < inp.options.length)v = inp.options[inp.selectedIndex].value;}else {var v = inp.value;}
 if (v != this._formLS[a].value){this._formLS[a].value = v;this.callEvent("onInputChange",[inp._idd,v,this]);}
 inp = null;}
 
 if (this._ccActive)this._ccTm = window.setTimeout(function(){that._ccDo();},100);}
 
 
 return this;};dhtmlXForm.prototype.getInput = function(id) {return this.doWithItem(id, "getInput");};dhtmlXForm.prototype.getSelect = function(id) {return this.doWithItem(id, "getSelect");};dhtmlXForm.prototype.items = {};dhtmlXForm.prototype.items.checkbox = {render: function(item, data) {item._type = "ch";item._enabled = true;item._checked = false;item._value = (typeof(data.value)=="undefined"?null:String(data.value));item._ro = (data.readonly==true);if (data._autoInputWidth !== false)data.inputWidth = 14;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea");item.childNodes[item._ll?1:0].className += " dhxform_img_node";var p = document.createElement("DIV");p.className = "dhxform_img chbx0";item.appendChild(p);if (!isNaN(data.inputLeft)) item.childNodes[item._ll?1:0].style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) item.childNodes[item._ll?1:0].style.top = parseInt(data.inputTop)+"px";item.childNodes[item._ll?1:0].appendChild(p);item.childNodes[item._ll?1:0].firstChild.value = String(data.value);item._updateImgNode = function(item, state) {if (item.getForm().skin != "dhx_terrace") return;var t = item.childNodes[item._ll?1:0].lastChild;if (state){t.className = t.className.replace(/dhxform_img/gi,"dhxform_actv_c");}else {t.className = t.className.replace(/dhxform_actv_c/gi,"dhxform_img");}
 t = null;}
 
 if (data.checked == true)this.check(item);if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);this.doAttachEvents(item);return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);this.doDestruct(item);},
 
 doAddLabel: function(item, data) {var t = document.createElement("DIV");t.className = "dhxform_label "+data.labelAlign;if (data.wrap == true)t.style.whiteSpace = "normal";if (item._ll){item.insertBefore(t,item.firstChild);}else {item.appendChild(t);}
 
 if (typeof(data.tooltip)!= "undefined") t.title = data.tooltip;t.innerHTML = "<div class='dhxform_label_nav_link' "+
 "onfocus='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,true);' "+
 "onblur='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,false);' "+
 "onkeypress='e=event||window.arguments[0];if(e.keyCode==32||e.charCode==32){e.cancelBubble=true;e.returnValue=false;_dhxForm_doClick(this,\"mousedown\");return false;}' "+
 (_dhxForm_isIPad?"ontouchstart='e=event;e.preventDefault();_dhxForm_doClick(this,\"mousedown\");' ":"")+
 "role='link' tabindex='0'>"+data.label+(data.info?"<span class='dhxform_info'>[?]</span>":"")+(item._required?"<span class='dhxform_item_required'>*</span>":"")+'</div>';if (!isNaN(data.labelWidth)) t.firstChild.style.width = parseInt(data.labelWidth)+"px";if (!isNaN(data.labelHeight)) t.firstChild.style.height = parseInt(data.labelHeight)+"px";if (!isNaN(data.labelLeft)) t.style.left = parseInt(data.labelLeft)+"px";if (!isNaN(data.labelTop)) t.style.top = parseInt(data.labelTop)+"px";},
 
 doAddInput: function(item, data, el, type, pos, dim, css) {var p = document.createElement("DIV");p.className = "dhxform_control";if (item._ll){item.appendChild(p);}else {item.insertBefore(p,item.firstChild);}
 
 var t = document.createElement(el);t.className = css;t.name = item._idd;t._idd = item._idd;t.id = data.uid;if (typeof(type)== "string") t.type = type;if (el == "INPUT" || el == "TEXTAREA"){t.onkeyup = function(e) {e = e||event;item.callEvent("onKeyUp",[this,e]);};}
 
 
 p.appendChild(t);if (data.readonly)this.setReadonly(item, true);if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);if (pos){if (!isNaN(data.inputLeft)) p.style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) p.style.top = parseInt(data.inputTop)+"px";}
 
 var u = "";if (dim){if (!isNaN(data.inputWidth)) u += "width:"+parseInt(data.inputWidth)+"px;";if (!isNaN(data.inputHeight)) u += "height:"+parseInt(data.inputHeight)+"px;";}
 if (typeof(data.style)== "string") u += data.style;t.style.cssText = u;if (data.maxLength)t.setAttribute("maxLength", data.maxLength);if (data.connector)t.setAttribute("connector",data.connector);if (typeof(data.note)== "object") {var note = document.createElement("DIV");note.className = "dhxform_note";note.style.width = (isNaN(data.note.width)?t.offsetWidth:parseInt(data.note.width))+"px";note._w = data.note.width;note.innerHTML = data.note.text;p.appendChild(note);note = null;}
 
 },
 
 doUnloadNestedLists: function(item) {if (!item._list)return;for (var q=0;q<item._list.length;q++){item._list[q].unload();item._list[q] = null;item._listObj[q] = null;item._listBase[q].parentNode.removeChild(item._listBase[q]);item._listBase[q] = null;}
 item._list = null;item._listObj = null;item._listBase = null;},
 
 doDestruct: function(item) {item.callEvent = null;item.checkEvent = null;item.getForm = null;item._autoCheck = null;item._checked = null;item._enabled = null;item._idd = null;item._type = null;item._value = null;item._group = null;item.onselectstart = null;item.childNodes[item._ll?1:0].onmousedown = null;item.childNodes[item._ll?1:0].ontouchstart = null;item.childNodes[item._ll?0:1].onmousedown = null;item.childNodes[item._ll?0:1].ontouchstart = null;item.childNodes[item._ll?0:1].childNodes[0].onkeypress = null;item.childNodes[item._ll?0:1].childNodes[0].ontouchstart = null;item.childNodes[item._ll?0:1].removeChild(item.childNodes[item._ll?0:1].childNodes[0]);while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);item = null;},
 
 doAttachEvents: function(item) {var that = this;item.childNodes[item._ll?1:0][_dhxForm_isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (e.preventDefault)e.preventDefault();var t = (e.target||e.srcElement);if (!this.parentNode._enabled || this.parentNode._ro || (typeof(t.className)!= "undefined" && t.className == "dhxform_note")) {e.cancelBubble = true;e.returnValue = false;return false;}
 that.doClick(this.parentNode);}
 
 item.childNodes[item._ll?0:1].childNodes[0][_dhxForm_isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (e.preventDefault)e.preventDefault();if (!this.parentNode.parentNode._enabled){e.cancelBubble = true;e.returnValue = false;return false;}
 
 var t = e.target||e.srcElement;if (typeof(t.className)!= "undefined" && t.className == "dhxform_info") {this.parentNode.parentNode.callEvent("onInfo",[this.parentNode.parentNode._idd]);e.cancelBubble = true;e.returnValue = false;return false;}
 that.doClick(this.parentNode.parentNode);}
 },
 
 doClick: function(item) {item.childNodes[item._ll?0:1].childNodes[0].focus();if (!item._enabled || item._ro)return;if (item.checkEvent("onBeforeChange")) if (item.callEvent("onBeforeChange", [item._idd, item._value, item._checked])!== true) return;this.setChecked(item, !item._checked);item._autoCheck();item.callEvent("onChange", [item._idd, item._value, item._checked]);},
 
 doCheckValue: function(item) {if (item._checked && item._enabled){item.childNodes[item._ll?1:0].firstChild.setAttribute("name", String(item._idd));}else {item.childNodes[item._ll?1:0].firstChild.removeAttribute("name");}
 },
 
 setChecked: function(item, state) {item._checked = (state===true?true:false);item.childNodes[item._ll?1:0].lastChild.className = item.childNodes[item._ll?1:0].lastChild.className.replace(/chbx[0-1]{1}/gi,"")+(item._checked?" chbx1":" chbx0");this.doCheckValue(item);},
 
 check: function(item) {this.setChecked(item, true);},
 
 unCheck: function(item) {this.setChecked(item, false);},
 
 isChecked: function(item) {return item._checked;},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;item.childNodes[item._ll?0:1].childNodes[0].tabIndex = 0;item.childNodes[item._ll?0:1].childNodes[0].removeAttribute("disabled");this.doCheckValue(item);},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;item.childNodes[item._ll?0:1].childNodes[0].tabIndex = -1;item.childNodes[item._ll?0:1].childNodes[0].setAttribute("disabled", "true");this.doCheckValue(item);},
 
 isEnabled: function(item) {return item._enabled;},
 
 setText: function(item, text) {item.childNodes[item._ll?0:1].childNodes[0].innerHTML = text;},
 
 getText: function(item) {return item.childNodes[item._ll?0:1].childNodes[0].innerHTML;},
 
 setValue: function(item, value) {this.setChecked(item,(value===true||item._value===value));},
 
 getValue: function(item) {return ((typeof(item._value)=="undefined"||item._value==null)?(item._checked?1:0):item._value);},
 
 setReadonly: function(item, state) {item._ro = (state===true);},
 
 isReadonly: function(item) {return item._ro;}
 
};dhtmlXForm.prototype.items.radio = {input: {},
 
 r: {},
 
 firstValue: {},
 
 render: function(item, data, uid) {item._type = "ra";item._enabled = true;item._checked = false;item._group = data.name;item._value = data.value;item._uid = uid;item._ro = (data.readonly==true);this.r[item._idd] = item;data.inputWidth = 14;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea");item.childNodes[item._ll?1:0].className += " dhxform_img_node";var p = document.createElement("DIV");p.className = "dhxform_img rdbt0";item.appendChild(p);if (!isNaN(data.inputLeft)) item.childNodes[item._ll?1:0].style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) item.childNodes[item._ll?1:0].style.top = parseInt(data.inputTop)+"px";item.childNodes[item._ll?1:0].appendChild(p);item.childNodes[item._ll?1:0].firstChild.value = String(data.value);item._updateImgNode = function(item, state) {if (item.getForm().skin != "dhx_terrace") return;var t = item.childNodes[item._ll?1:0].lastChild;if (state){t.className = t.className.replace(/dhxform_img/gi,"dhxform_actv_r");}else {t.className = t.className.replace(/dhxform_actv_r/gi,"dhxform_img");}
 t = null;}
 
 
 if (this.input[data.name] == null){var k = document.createElement("INPUT");k.type = "HIDDEN";k.name = data.name;k.firstValue = item._value;item.appendChild(k);this.input[data.name] = k;}
 
 if (!this.firstValue[data.name])this.firstValue[data.name] = data.value;if (data.checked == true)this.check(item);if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);this.doAttachEvents(item);return this;},
 
 destruct: function(item, value) {if (item.lastChild == this.input[item._group]){var done = false;for (var a in this.r){if (!done && this.r[a]._group == item._group && this.r[a]._idd != item._idd){this.r[a].appendChild(this.input[item._group]);done = true;}
 }
 if (!done){this.input[item._group].parentNode.removeChild(this.input[item._group]);this.input[item._group] = null;this.firstValue[item._group] = null;}
 }
 
 var id = item._idd;this.doUnloadNestedLists(item);this.doDestruct(item);return id;},
 
 doClick: function(item) {item.childNodes[item._ll?0:1].childNodes[0].focus();if (!(item._enabled && !item._checked)) return;if (item._ro)return;var args = [item._group, item._value, true];if (item.checkEvent("onBeforeChange")) if (item.callEvent("onBeforeChange", args)!== true) return;this.setChecked(item, true);item.getForm()._autoCheck();item.callEvent("onChange", args);},
 
 doCheckValue: function(item) {var value = null;for (var a in this.r){if (this.r[a]._checked && this.r[a]._enabled && this.r[a]._group == item._group && this.r[a]._rId == item._rId)value = this.r[a]._value;}
 if (value != null){this.input[item._group].setAttribute("name", String(item._group));this.input[item._group].setAttribute("value", value);this.input[item._group]._value = value;}else {this.input[item._group].removeAttribute("name");this.input[item._group].removeAttribute("value");this.input[item._group]._value = null;}
 },
 
 setChecked: function(item, state) {state = (state===true);for (var a in this.r){if (this.r[a]._group == item._group && this.r[a]._rId == item._rId){var needCheck = false;if (this.r[a]._idd == item._idd){if (this.r[a]._checked != state){this.r[a]._checked = state;needCheck = true;}
 }else {if (this.r[a]._checked){this.r[a]._checked = false;needCheck = true;}
 }
 if (needCheck){var t = this.r[a].childNodes[this.r[a]._ll?1:0].childNodes[1];t.className = t.className.replace(/rdbt[0-1]{1}/gi,"")+(this.r[a]._checked?" rdbt1":" rdbt0");t = null;}
 }
 }
 this.doCheckValue(item);},
 
 getChecked: function(item) {return this.input[item._group]._value;},
 
 _getFirstValue: function(item) {return this.firstValue[item._group];},
 
 _getId: function(item) {return item._idd;},
 
 setValue: function(item, value) {}
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doDestruct:1,doUnloadNestedLists:1,doAttachEvents:1,check:1,unCheck:1,isChecked:1,enable:1,disable:1,isEnabled:1,setText:1,getText:1,getValue:1,setReadonly:1,isReadonly:1})dhtmlXForm.prototype.items.radio[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.select = {render: function(item, data) {item._type = "se";item._enabled = true;item._value = null;item._newValue = null;if ((_isFF||_isIE)&& typeof(data.inputWidth) == "number") data.inputWidth+=(item._inpWidthFix||2);this.doAddLabel(item, data);this.doAddInput(item, data, "SELECT", null, true, true, "dhxform_select");this.doAttachEvents(item);this.doLoadOpts(item, data);if (data.connector){var that = this;item._connector_working = true;dhtmlxAjax.get(data.connector, function(loader) {var opts = loader.doXPath("//item");var opt_data = [];for (var i=0;i<opts.length;i++){opt_data[i] = {label:opts[i].getAttribute("label"), value:opts[i].getAttribute("value"), selected: (opts[i].getAttribute("selected")!=null)};};that.doLoadOpts(item, {options:opt_data}, true);item._connector_working = false;if (item._connector_value != null){that.setValue(item, item._connector_value);item._connector_value = null;}
 });}
 
 return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);item.callEvent = null;item.checkEvent = null;item.getForm = null;item._autoCheck = null;item._enabled = null;item._idd = null;item._type = null;item._value = null;item._newValue = null;item.onselectstart = null;item.childNodes[item._ll?1:0].childNodes[0].onclick = null;item.childNodes[item._ll?1:0].childNodes[0].onkeydown = null;item.childNodes[item._ll?1:0].childNodes[0].onchange = null;item.childNodes[item._ll?1:0].childNodes[0].onfocus = null;item.childNodes[item._ll?1:0].childNodes[0].onblur = null;item.childNodes[item._ll?1:0].childNodes[0].onkeyup = null;item.childNodes[item._ll?1:0].removeChild(item.childNodes[item._ll?1:0].childNodes[0]);while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);item = null;},
 
 doAddLabel: function(item, data) {var j = document.createElement("DIV");j.className = "dhxform_label "+data.labelAlign;j.innerHTML = "<label for='"+data.uid+"'>"+
 data.label+
 (data.info?"<span class='dhxform_info'>[?]</span>":"")+
 (item._required?"<span class='dhxform_item_required'>*</span>":"")+
 "</label>";if (data.wrap == true)j.style.whiteSpace = "normal";if (typeof(data.tooltip)!= "undefined") j.title = data.tooltip;item.appendChild(j);if (typeof(data.label)== "undefined" || data.label == null || data.label.length == 0) j.style.display = "none";if (!isNaN(data.labelWidth)) j.style.width = parseInt(data.labelWidth)+"px";if (!isNaN(data.labelHeight)) j.style.height = parseInt(data.labelHeight)+"px";if (!isNaN(data.labelLeft)) j.style.left = parseInt(data.labelLeft)+"px";if (!isNaN(data.labelTop)) j.style.top = parseInt(data.labelTop)+"px";if (data.info){j.onclick = function(e) {e = e||event;var t = e.target||e.srcElement;if (typeof(t.className)!= "undefined" && t.className == "dhxform_info") {this.parentNode.callEvent("onInfo",[this.parentNode._idd]);e.cancelBubble = true;e.returnValue = false;return false;}
 }
 }
 },
 
 doAttachEvents: function(item) {var t = item.childNodes[1].childNodes[0];var that = this;t.onclick = function() {that.doOnChange(this);that.doValidate(this.parentNode.parentNode);}
 t.onkeydown = function() {that.doOnChange(this);that.doValidate(this.parentNode.parentNode);}
 t.onchange = function() {that.doOnChange(this);that.doValidate(this.parentNode.parentNode);}
 t = null;this.doAttachChangeLS(item);},
 
 doAttachChangeLS: function(item) {var t = item.childNodes[1].childNodes[0];t.onfocus = function() {var i = this.parentNode.parentNode;i.getForm()._ccActivate(i._idd, this, i.getForm().getItemValue(i._idd,true));}
 t.onblur = function() {var i = this.parentNode.parentNode;i.getForm()._ccDeactivate(i._idd);}
 t = null;},
 
 doValidate: function(item) {if (item.getForm().live_validate) this._validate(item);},
 
 doLoadOpts: function(item, data, callEvent) {var t = item.childNodes[item._ll?1:0].childNodes[0];var opts = data.options;for (var q=0;q<opts.length;q++){var t0 = opts[q].text||opts[q].label;if (!t0 || typeof(t0)== "undefined") t0 = "";var opt = new Option(t0, opts[q].value);if (typeof(opts[q].img_src)== "string") opt.setAttribute("img_src", opts[q].img_src);t.options.add(opt);if (opts[q].selected == true || opts[q].selected == "true"){opt.selected = true;item._value = opts[q].value;}
 }
 if (callEvent === true)item.callEvent("onOptionsLoaded", [item._idd]);this._checkNoteWidth(item);},
 
 doOnChange: function(sel) {var item = sel.parentNode.parentNode;item._newValue = (sel.selectedIndex>=0?sel.options[sel.selectedIndex].value:null);if (item._newValue != item._value){if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange", [item._idd, item._value, item._newValue])!== true) {for (var q=0;q<sel.options.length;q++)if (sel.options[q].value == item._value)sel.options[q].selected = true;return;}
 }
 item._value = item._newValue;item.callEvent("onChange", [item._idd, item._value]);}
 item._autoCheck();},
 
 setText: function(item, text) {if (!text)text = "";item.childNodes[item._ll?0:1].childNodes[0].innerHTML = text;item.childNodes[item._ll?0:1].style.display = (text.length==0||text==null?"none":"");},
 
 getText: function(item) {return item.childNodes[item._ll?0:1].childNodes[0].innerHTML;},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;item.childNodes[item._ll?1:0].childNodes[0].removeAttribute("disabled");},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;item.childNodes[item._ll?1:0].childNodes[0].setAttribute("disabled", true);},
 
 getOptions: function(item) {return item.childNodes[item._ll?1:0].childNodes[0].options;},
 
 setValue: function(item, val) {if (item._connector_working){item._connector_value = val;return;}
 var opts = this.getOptions(item);for (var q=0;q<opts.length;q++){if (opts[q].value == val){opts[q].selected = true;item._value = opts[q].value;}
 }
 
 },
 
 getValue: function(item) {var k = -1;var opts = this.getOptions(item);for (var q=0;q<opts.length;q++)if (opts[q].selected)k = opts[q].value;return k;},
 
 setWidth: function(item, width) {item.childNodes[item._ll?1:0].childNodes[0].style.width = width+"px";},
 
 getSelect: function(item) {return item.childNodes[item._ll?1:0].childNodes[0];},
 
 setFocus: function(item) {item.childNodes[item._ll?1:0].childNodes[0].focus();},
 
 _checkNoteWidth: function(item) {var t;if (item.childNodes[item._ll?1:0].childNodes[1] != null){t = item.childNodes[item._ll?1:0].childNodes[1];if (t.className != null && t.className.search(/dhxform_note/gi)>= 0 && t._w == "auto") t.style.width = item.childNodes[item._ll?1:0].childNodes[0].offsetWidth+"px";}
 t = null;}
 
};(function(){for (var a in {doAddInput:1,doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.select[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.multiselect = {doLoadOpts: function(item, data, callEvent) {var t = item.childNodes[item._ll?1:0].childNodes[0];t.multiple = true;if (!isNaN(data.size)) t.size = Number(data.size);item._value = [];item._newValue = [];var opts = data.options;for (var q=0;q<opts.length;q++){var opt = new Option(opts[q].text||opts[q].label, opts[q].value);t.options.add(opt);if (opts[q].selected == true || opts[q].selected == "true"){opt.selected = true;item._value.push(opts[q].value);}
 }
 if (callEvent === true)item.callEvent("onOptionsLoaded", [item._idd]);this._checkNoteWidth(item);},
 
 doAttachEvents: function(item) {var t = item.childNodes[item._ll?1:0].childNodes[0];var that = this;t.onblur = function() {that.doOnChange(this);}
 
 t.onclick = function() {item._autoCheck();}
 
 },
 
 doOnChange: function(sel) {var item = sel.parentNode.parentNode;item._newValue = [];for (var q=0;q<sel.options.length;q++)if (sel.options[q].selected)item._newValue.push(sel.options[q].value);if ((item._value).sort().toString() != (item._newValue).sort().toString()) {if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange", [item._idd, item._value, item._newValue])!== true) {var k = {};for (var q=0;q<item._value.length;q++)k[item._value[q]] = true;for (var q=0;q<sel.options.length;q++)sel.options[q].selected = (k[sel.options[q].value] == true);k = null;return;}
 }
 item._value = [];for (var q=0;q<item._newValue.length;q++)item._value.push(item._newValue[q]);item.callEvent("onChange", [item._idd, item._value]);}
 
 
 item._autoCheck();},
 
 setValue: function(item, val) {var k = {};if (typeof(val)== "string") val = val.split(",");if (typeof(val)!= "object") val = [val];for (var q=0;q<val.length;q++)k[val[q]] = true;var opts = this.getOptions(item);for (var q=0;q<opts.length;q++)opts[q].selected = (k[opts[q].value] == true);item._autoCheck();},
 
 getValue: function(item) {var k = [];var opts = this.getOptions(item);for (var q=0;q<opts.length;q++)if (opts[q].selected)k.push(opts[q].value);return k;}
};(function() {for (var a in dhtmlXForm.prototype.items.select){if (!dhtmlXForm.prototype.items.multiselect[a])dhtmlXForm.prototype.items.multiselect[a] = dhtmlXForm.prototype.items.select[a];}
})();dhtmlXForm.prototype.items.input = {render: function(item, data) {var ta = (!isNaN(data.rows));item._type = "ta";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, (ta?"TEXTAREA":"INPUT"), (ta?null:"TEXT"), true, true, "dhxform_textarea");this.doAttachEvents(item);if (ta)item.childNodes[item._ll?1:0].childNodes[0].rows = data.rows;if (typeof(data.numberFormat)!= "undefined") {var a,b=null,c=null;if (typeof(data.numberFormat)!= "string") {a = data.numberFormat[0];b = data.numberFormat[1]||null;c = data.numberFormat[2]||null;}else {a = data.numberFormat;if (typeof(data.groupSep)== "string") b = data.groupSep;if (typeof(data.decSep)== "string") c = data.decSep;}
 this.setNumberFormat(item, a, b, c, false);}
 
 this.setValue(item, data.value);return this;},
 
 doAttachEvents: function(item) {var that = this;if (item._type == "ta" || item._type == "se" || item._type == "pw"){item.childNodes[item._ll?1:0].childNodes[0].onfocus = function() {var i = this.parentNode.parentNode;if (i._df != null)this.value = i._value||"";i.getForm()._ccActivate(i._idd, this, this.value);}
 }
 
 item.childNodes[item._ll?1:0].childNodes[0].onblur = function() {var i = this.parentNode.parentNode;i.getForm()._ccDeactivate(i._idd);that.updateValue(i);if (i.getForm().live_validate) that._validate(i);i = null;}
 },
 
 updateValue: function(item) {var value = item.childNodes[item._ll?1:0].childNodes[0].value;if (item._df != null && value == this._getFmtValue(item, value)) return;var t = this;if (item._value != value){if (item.checkEvent("onBeforeChange")) if (item.callEvent("onBeforeChange",[item._idd, item._value, value])!== true) {if (item._df != null)t.setValue(item, item._value);else item.childNodes[item._ll?1:0].childNodes[0].value = item._value;return;}
 
 if (item._df != null)t.setValue(item, value);else item._value = value;item.callEvent("onChange",[item._idd, value]);return;}
 if (item._df != null)this.setValue(item, item._value);},
 
 setValue: function(item, value) {item._value = (typeof(value) != "undefined" && value != null ? value : "");var v = (item._value||"");var k = item.childNodes[item._ll?1:0].childNodes[0];if (item._df != null && typeof(this._getFmtValue)== "function") v = this._getFmtValue(item, v);if (k.value != v){k.value = v;}
 
 k = null;},
 
 getValue: function(item) {return (typeof(item._value) != "undefined" && item._value != null ? item._value : "");},
 
 setReadonly: function(item, state) {item._ro = (state===true);if (item._ro){item.childNodes[item._ll?1:0].childNodes[0].setAttribute("readOnly", "true");}else {item.childNodes[item._ll?1:0].childNodes[0].removeAttribute("readOnly");}
 },
 
 isReadonly: function(item) {if (!item._ro)item._ro = false;return item._ro;},
 
 getInput: function(item) {return item.childNodes[item._ll?1:0].childNodes[0];},
 
 setNumberFormat: function(item, format, g_sep, d_sep, refresh) {if (typeof(refresh)!= "boolean") refresh = true;if (format == ""){item._df = null;if (refresh)this.setValue(item, item._value);return true;}
 
 if (typeof(format)!= "string") return;var t = format.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);if (t == null || t.length != 4)return false;item._df = {i_len: false,
 i_sep: (typeof(g_sep)=="string"?g_sep:","),
 
 d_len: false,
 d_sep: (typeof(d_sep)=="string"?d_sep:"."),
 
 s_bef: (typeof(t[1])=="string"?t[1]:""),
 s_aft: (typeof(t[3])=="string"?t[3]:"")
 };var f = t[2].split(".");if (f[1] != null)item._df.d_len = f[1].length;var r = f[0].split(",");if (r.length > 1)item._df.i_len = r[r.length-1].length;if (refresh)this.setValue(item, item._value);return true;},
 
 _getFmtValue: function(item, v) {var r = v.match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/);if (r != null && r.length == 5){var v0 = "";if (r[1] != null)v0 += r[1];v0 += item._df.s_bef;if (item._df.i_len !== false){var i = 0;var v1 = "";for (var q=r[2].length-1;q>=0;q--){v1 = ""+r[2][q]+v1;if (++i == item._df.i_len && q > 0){v1=item._df.i_sep+v1;i=0;}
 }
 v0 += v1;}else {v0 += r[2];}
 
 if (item._df.d_len !== false){if (r[4] == null)r[4] = "";while (r[4].length < item._df.d_len)r[4] += "0";eval("var t0 = new RegExp(/\\d{"+item._df.d_len+"}/);");var t1 = (r[4]).match(t0);if (t1 != null)v0 += item._df.d_sep+t1;t0 = t1 = null;}
 
 v0 += item._df.s_aft;return v0;}
 
 return v;}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setFocus:1})dhtmlXForm.prototype.items.input[a] = dhtmlXForm.prototype.items.select[a];})();dhtmlXForm.prototype.items.password = {render: function(item, data) {item._type = "pw";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "PASSWORD", true, true, "dhxform_textarea");this.doAttachEvents(item);this.setValue(item, data.value);return this;}
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doAttachEvents:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,setValue:1,getValue:1,updateValue:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setFocus:1,getInput:1})dhtmlXForm.prototype.items.password[a] = dhtmlXForm.prototype.items.input[a];})();dhtmlXForm.prototype.items.file = {render: function(item, data) {item._type = "fl";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "FILE", true, false, "dhxform_textarea");item.childNodes[item._ll?1:0].childNodes[0].onchange = function() {item.callEvent("onChange", [item._idd, this.value]);}
 
 return this;},
 
 setValue: function(){},
 
 getValue: function(item) {return item.childNodes[item._ll?1:0].childNodes[0].value;}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1})dhtmlXForm.prototype.items.file[a] = dhtmlXForm.prototype.items.input[a];})();dhtmlXForm.prototype.items.label = {_index: false,
 
 render: function(item, data) {item._type = "lb";item._enabled = true;item._checked = true;var t = document.createElement("DIV");t.className = "dhxform_txt_label2"+(data._isTopmost?" topmost":"");t.innerHTML = data.label;item.appendChild(t);if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);if (!isNaN(data.labelWidth)) t.style.width = parseInt(data.labelWidth)+"px";if (!isNaN(data.labelHeight)) t.style.height = parseInt(data.labelHeight)+"px";if (!isNaN(data.labelLeft)) t.style.left = parseInt(data.labelLeft)+"px";if (!isNaN(data.labelTop)) t.style.top = parseInt(data.labelTop)+"px";return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);item._autoCheck = null;item._enabled = null;item._type = null;item.callEvent = null;item.checkEvent = null;item.getForm = null;item.onselectstart = null;item.parentNode.removeChild(item);item = null;},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;},
 
 setText: function(item, text) {item.firstChild.innerHTML = text;},

 getText: function(item) {return item.firstChild.innerHTML;}
 
};(function(){for (var a in {doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.label[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.button = {render: function(item, data) {item._type = "bt";item._enabled = true;item._name = data.name;item.className = String(item.className).replace("item_label_top","item_label_left").replace("item_label_right","item_label_left");if (!isNaN(data.width)) var w = Math.max(data.width,10);var k = (typeof(w) != "undefined");item.innerHTML = '<div class="dhxform_btn" role="link" tabindex="0" dir="ltr" '+(k?' style="width:'+w+'px;"':'')+
 'onkeypress="e=event||window.arguments[0];if((e.keyCode==32||e.charCode==32||e.keyCode==13||e.charCode==13)&&!this.parentNode._busy){this.parentNode._busy=true;e.cancelBubble=true;e.returnValue=false;_dhxForm_doClick(this.childNodes[0],[\'mousedown\',\'mouseup\']);return false;}" '+
 'ontouchstart="e=event;e.preventDefault();if(!this.parentNode._busy){this.parentNode._busy=true;_dhxForm_doClick(this.childNodes[0],[\'mousedown\',\'mouseup\']);}" '+
 'onblur="_dhxForm_doClick(this.childNodes[0],\'mouseout\');" >'+
 '<table cellspacing="0" cellpadding="0" border="0" align="left" style="font-size:inherit;'+(k?'width:'+w+'px;table-layout:fixed;':'')+'">'+
 '<tr>'+
 '<td class="btn_l"><div class="btn_l">&nbsp;</div></td>'+
 '<td class="btn_m" '+(k?'style="width:'+(w-10)+'px;"':'')+'>'+
 '<div class="btn_txt'+(k?" btn_txt_fixed_size":"")+'">'+data.value+'</div></td>'+
 '<td class="btn_r"><div class="btn_r">&nbsp;</div></td>'+
 '</tr>'+
 '</table>'+
 "</div>";if (!isNaN(data.inputLeft)) item.childNodes[0].style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) item.childNodes[0].style.top = parseInt(data.inputTop)+"px";if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);if (typeof(data.tooltip)!= "undefined") item.firstChild.title = data.tooltip;item.onselectstart = function(e){e=e||event;e.cancelBubble=true;e.returnValue=false;return false;}
 item.childNodes[0].onselectstart = function(e){e=e||event;e.cancelBubble=true;e.returnValue=false;return false;}
 
 item.childNodes[0].childNodes[0].onmouseover = function(){var t = this.parentNode.parentNode;if (!t._enabled)return;this._isOver = true;this.className = "dhxform_btn_over";t = null;}
 item.childNodes[0].childNodes[0].onmouseout = function(){var t = this.parentNode.parentNode;if (!t._enabled)return;this.className = "";this._allowClick = false;this._pressed = false;this._isOver = false;t = null;}
 item.childNodes[0].childNodes[0].onmousedown = function(){if (this._pressed)return;var t = this.parentNode.parentNode;if (!t._enabled)return;this.className = "dhxform_btn_pressed";this._allowClick = true;this._pressed = true;t = null;}
 
 item.childNodes[0].childNodes[0].onmouseup = function(){if (!this._pressed)return;var t = this.parentNode.parentNode;if (!t._enabled)return;t._busy = false;this.className = (this._isOver?"dhxform_btn_over":"");if (this._pressed && this._allowClick)t.callEvent("_onButtonClick", [t._name, t._cmd]);this._allowClick = false;this._pressed = false;t = null;}
 
 return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);item.callEvent = null;item.checkEvent = null;item.getForm = null;item._autoCheck = null;item._type = null;item._enabled = null;item._cmd = null;item._name = null;item.onselectstart = null;item.childNodes[0].onselectstart = null;item.childNodes[0].onkeypress = null;item.childNodes[0].ontouchstart = null;item.childNodes[0].onblur = null;item.childNodes[0].childNodes[0].onmouseover = null;item.childNodes[0].childNodes[0].onmouseout = null;item.childNodes[0].childNodes[0].onmousedown = null;item.childNodes[0].childNodes[0].onmouseup = null;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);item = null;},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;item.childNodes[0].tabIndex = 0;item.childNodes[0].removeAttribute("disabled");},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;item.childNodes[0].tabIndex = -1;item.childNodes[0].setAttribute("disabled", "true");},
 
 setText: function(item, text) {item.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].innerHTML = text;},

 getText: function(item) {return item.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].childNodes[0].innerHTML;}
 
};(function(){for (var a in {doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.button[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.hidden = {_index: false,
 
 render: function(item, data) {item.style.display = "none";item._name = data.name;item._type = "hd";item._enabled = true;var t = document.createElement("INPUT");t.type = "HIDDEN";t.name = data.name;t.value = (data.value||"")
 item.appendChild(t);return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item._autoCheck = null;item._name = null;item._type = null;item._enabled = null;item.onselectstart = null;item.callEvent = null;item.checkEvent = null;item.getForm = null;item.parentNode.removeChild(item);item = null;},
 
 enable: function(item) {item._enabled = true;item.childNodes[0].setAttribute("name", item._name);},
 
 disable: function(item) {item._enabled = false;item.childNodes[0].removeAttribute("name");},
 
 show: function() {},
 
 hide: function() {},
 
 isHidden: function() {return true;},
 
 setValue: function(item, val) {item.childNodes[0].value = val;},
 
 getValue: function(item) {return item.childNodes[0].value;},
 
 getInput: function(item) {return item.childNodes[0];}
 
};(function(){for (var a in {doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.hidden[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.list = {_index: false,
 
 render: function(item) {item._type = "list";item._enabled = true;item._isNestedForm = true;item.className = "dhxform_base_nested";return [this, new dhtmlXForm(item)];},
 
 destruct: function(item) {}
};dhtmlXForm.prototype.items.fieldset = {_index: false,
 
 render: function(item, data) {item._type = "fs";if (typeof(parseInt(data.inputWidth)) == "number") {if (_isFF||_isOpera)data.inputWidth -= 12;}
 
 item._width = data.width;item._enabled = true;item._checked = true;item.className = "fs_"+data.position+(typeof(data.className)=="string"?" "+data.className:"");var f = document.createElement("FIELDSET");f.className = "dhxform_fs";var align = String(data.labelAlign).replace("align_","");f.innerHTML = "<legend class='fs_legend' align='"+align+"' style='text-align:"+align+"'>"+data.label+"</legend>";item.appendChild(f);if (!isNaN(data.inputLeft)) f.style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) f.style.top = parseInt(data.inputTop)+"px";if (data.inputWidth != "auto")if (!isNaN(data.inputWidth)) f.style.width = parseInt(data.inputWidth)+"px";item._addSubListNode = function() {var t = document.createElement("DIV");this.childNodes[0].appendChild(t);return t;}
 
 if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);item._checked = null;item._enabled = null;item._idd = null;item._type = null;item._width = null;item.onselectstart = null;item._addSubListNode = null;item._autoCheck = null;item.callEvent = null;item.checkEvent = null;item.getForm = null;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);item = null;},
 
 setText: function(item, text) {item.childNodes[0].childNodes[0].innerHTML = text;},
 
 getText: function(item) {return item.childNodes[0].childNodes[0].innerHTML;},
 
 enable: function(item) {item._enabled = true;if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");},
 
 disable: function(item) {item._enabled = false;if (String(item.className).search("disabled") < 0) item.className += " disabled";},
 
 setWidth: function(item, width) {item.childNodes[0].style.width = width+"px";item._width = width;},
 
 getWidth: function(item) {return item._width;}
 
};(function(){for (var a in {doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.fieldset[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.items.block = {_index: false,
 
 render: function(item, data) {item._type = "bl";item._width = data.width;item._enabled = true;item._checked = true;item.className = "block_"+data.position+(typeof(data.className)=="string"?" "+data.className:"");var b = document.createElement("DIV");b.className = "dhxform_block";if (data.style)b.style.cssText = data.style;if (typeof(data.id)!= "undefined") b.id = data.id;item.appendChild(b);if (!isNaN(data.inputLeft)) b.style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) b.style.top = parseInt(data.inputTop)+"px";if (data.inputWidth != "auto")if (!isNaN(data.inputWidth)) b.style.width = parseInt(data.inputWidth)+"px";item._addSubListNode = function() {var t = document.createElement("DIV");t._inBlcok = true;this.childNodes[0].appendChild(t);return t;}
 
 if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);return this;},
 
 _setCss: function(item, skin, fontSize) {item.firstChild.className = "dhxform_obj_"+skin+" dhxform_block";item.firstChild.style.fontSize = fontSize;}
};(function(){for (var a in {enable:1,disable:1,isEnabled:1,setWidth:1,getWidth:1,doUnloadNestedLists:1,destruct:1})dhtmlXForm.prototype.items.block[a] = dhtmlXForm.prototype.items.fieldset[a];})();dhtmlXForm.prototype.items.newcolumn = {_index: false
};dhtmlXForm.prototype.items.template = {render: function(item, data) {var ta = (!isNaN(data.rows));item._type = "tp";item._enabled = true;if (data.format){if (typeof(data.format)== "function") item.format = data.format;if (typeof(window[data.format])== "function") item.format = window[data.format];}
 if (!item.format)item.format = function(name, value) {return value;}
 
 this.doAddLabel(item, data);this.doAddInput(item, data, "DIV", null, true, true, "dhxform_item_template");item._value = (data.value||"");item.childNodes[1].childNodes[0].innerHTML = item.format(item._idd, item._value);return this;},
 
 
 
 
 setValue: function(item, value) {item._value = value;item.childNodes[1].childNodes[0].innerHTML = item.format(item._idd, item._value);},
 
 getValue: function(item) {return item._value;},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,destruct:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,setWidth:1})dhtmlXForm.prototype.items.template[a] = dhtmlXForm.prototype.items.select[a];})();dhtmlXForm.prototype._ulToObject = function(ulData, a) {var obj = [];for (var q=0;q<ulData.childNodes.length;q++){if (String(ulData.childNodes[q].tagName||"").toLowerCase() == "li") {var p = {};var t = ulData.childNodes[q];for (var w=0;w<a.length;w++)if (t.getAttribute(a[w])!= null) p[String(a[w]).replace("ftype","type")] = t.getAttribute(a[w]);if (!p.label)try {p.label = t.firstChild.nodeValue;}catch(e){}
 var n = t.getElementsByTagName("UL");if (n[0] != null)p[(p.type=="select"?"options":"list")] = dhtmlXForm.prototype._ulToObject(n[0], a);for (var w=0;w<t.childNodes.length;w++){if (String(t.childNodes[w].tagName||"").toLowerCase() == "userdata") {if (!p.userdata)p.userdata = {};p.userdata[t.childNodes[w].getAttribute("name")] = t.childNodes[w].firstChild.nodeValue;}
 }
 obj[obj.length] = p;}
 if (String(ulData.childNodes[q].tagName||"").toLowerCase() == "div") {var p = {};p.type = "label";try {p.label = ulData.childNodes[q].firstChild.nodeValue;}catch(e){}
 obj[obj.length] = p;}
 }
 return obj;};dhtmlxEvent(window, "load", function(){var a = [
 "ftype", "name", "value", "label", "check", "checked", "disabled", "text", "rows", "select", "selected", "width", "style", "className",
 "labelWidth", "labelHeight", "labelLeft", "labelTop", "inputWidth", "inputHeight", "inputLeft", "inputTop", "position", "size"
 ];var k = document.getElementsByTagName("UL");var u = [];for (var q=0;q<k.length;q++){if (k[q].className == "dhtmlxForm"){var formNode = document.createElement("DIV");u[u.length] = {nodeUL:k[q], nodeForm:formNode, data:dhtmlXForm.prototype._ulToObject(k[q], a), name:(k[q].getAttribute("name")||null)};}
 }
 for (var q=0;q<u.length;q++){u[q].nodeUL.parentNode.insertBefore(u[q].nodeForm, u[q].nodeUL);var listObj = new dhtmlXForm(u[q].nodeForm, u[q].data);if (u[q].name !== null)window[u[q].name] = listObj;var t = (u[q].nodeUL.getAttribute("oninit")||null);u[q].nodeUL.parentNode.removeChild(u[q].nodeUL);u[q].nodeUL = null;u[q].nodeForm = null;u[q].data = null;u[q] = null;if (t){if (typeof(t)== "function") t();else if (typeof(window[t])== "function") window[t]();}
 }
});if (window.dhtmlXContainer){if (!dhtmlx.attaches)dhtmlx.attaches = {};if (!dhtmlx.attaches["attachForm"]){dhtmlx.attaches["attachForm"] = function(data) {var obj = document.createElement("DIV");obj.id = "dhxFormObj_"+this._genStr(12);obj.style.position = "relative";obj.style.width = "100%";obj.style.height = "100%";obj.style.overflow = "auto";obj.cmp = "form";this.attachObject(obj, false, true, false);this.vs[this.av].form = new dhtmlXForm(obj, data);this.vs[this.av].form.setSkin(this.skin);this.vs[this.av].form.setSizes();this.vs[this.av].formObj = obj;if (this.skin == "dhx_terrace"){this.adjust();this.updateNestedObjects();}
 
 return this.vs[this.av].form;}
 }
 
 if (!dhtmlx.detaches)dhtmlx.detaches = {};if (!dhtmlx.detaches["detachForm"]){dhtmlx.detaches["detachForm"] = function(contObj) {if (!contObj.form)return;contObj.form.unload();contObj.form = null;contObj.formObj = null;contObj.attachForm = null;}
 }
};dhtmlXForm.prototype.setUserData = function(id, name, value, rValue) {if (typeof(rValue)!= "undefined") {var k = this.doWithItem([id,name], "_getId");if (k != null){id = k;name = value;value = rValue;}
 }
 if (!this._userdata)this._userdata = {};this._userdata[id] = (this._userdata[id]||{});this._userdata[id][name] = value;};dhtmlXForm.prototype.getUserData = function(id, name, rValue) {if (typeof(rValue)!= "undefined") {var k = this.doWithItem([id,name], "_getId");if (k != null){id = k;name = rValue;}
 }
 if (this._userdata != null && typeof(this._userdata[id])!= "undefined" && typeof(this._userdata[id][name]) != "undefined") return this._userdata[id][name];return "";};dhtmlXForm.prototype.setRTL = function(state) {this._rtl = (state===true?true:false);for (var q=0;q<this.base.length;q++){if (this._rtl){if (String(this.base[q].className).search(/dhxform_rtl/gi) < 0) this.base[q].className += " dhxform_rtl";}else {if (String(this.base[q].className).search(/dhxform_rtl/gi) >= 0) this.base[q].className = String(this.base[q].className).replace(/dhxform_rtl/gi,"");}
 }
};_dhxForm_doClick = function(obj, evType) {if (typeof(evType)== "object") {var t = evType[1];evType = evType[0];}
 if (document.createEvent){var e = document.createEvent("MouseEvents");e.initEvent(evType, true, false);obj.dispatchEvent(e);}else if (document.createEventObject){var e = document.createEventObject();e.button = 1;obj.fireEvent("on"+evType, e);}
 if (t)window.setTimeout(function(){_dhxForm_doClick(obj,t);},100);}
dhtmlXForm.prototype.setFormData = function(t) {for (var a in t){var r = this.getItemType(a);switch (r) {case "checkbox":
 this[t[a]==true||parseInt(t[a])==1||t[a]=="true"?"checkItem":"uncheckItem"](a);break;case "radio":
 this.checkItem(a,t[a]);break;case "input":
 case "textarea":
 case "select":
 case "multiselect":
 case "hidden":
 case "template":
 case "combo":
 case "calendar":
 case "colorpicker":
 case "editor":
 this.setItemValue(a,t[a]);break;default:
 if (this["setFormData_"+r]){this["setFormData_"+r](a,t[a]);}else {if (!this.hId)this.hId = this._genStr(12);this.setUserData(this.hId, a, t[a]);}
 break;}
 }
};dhtmlXForm.prototype.getFormData = function(p0, only_fields) {this._updateValues();var r = {};var that = this;for (var a in this.itemPull){var i = this.itemPull[a]._idd;var t = this.itemPull[a]._type;if (t == "ch")r[i] = (this.isItemChecked(i)?this.getItemValue(i):0);if (t == "ra" && !r[this.itemPull[a]._group])r[this.itemPull[a]._group] = this.getCheckedValue(this.itemPull[a]._group);if (t in {se:1,ta:1,pw:1,hd:1,tp:1,fl:1,calendar:1,combo:1,editor:1,colorpicker:1})r[i] = this.getItemValue(i,p0);if (this["getFormData_"+t])r[i] = this["getFormData_"+t](i);if (t == "up"){var r0 = this.getItemValue(i);for (var a0 in r0)r[a0] = r0[a0];}
 
 if (this.itemPull[a]._list){for (var q=0;q<this.itemPull[a]._list.length;q++){var k = this.itemPull[a]._list[q].getFormData(p0,only_fields);for (var b in k)r[b] = k[b];}
 }
 }
 
 if (!only_fields && this.hId && this._userdata[this.hId]){for (var a in this._userdata[this.hId]){if (!r[a])r[a] = this._userdata[this.hId][a];}
 }
 return r;};dhtmlXForm.prototype.adjustParentSize = function(pId) {var kx = 0;var ky = -1;for (var q=0;q<this.base.length;q++){kx += this.base[q].offsetWidth;if (this.base[q].offsetHeight > ky)ky = this.base[q].offsetHeight;}
 
 
 var isLayout = false;try {isLayout = (this.cont.parentNode.parentNode.parentNode.parentNode._isCell==true);if (isLayout)var layoutCell = this.cont.parentNode.parentNode.parentNode.parentNode;}catch(e){};if (isLayout && typeof(layoutCell)!= "undefined") {if (kx > 0)layoutCell.setWidth(kx+10);if (ky > 0)layoutCell.setHeight(ky+layoutCell.firstChild.firstChild.offsetHeight+5);isLayout = layoutCell = null;return;}
 
 
 var isWindow = false;try {isWindow = (this.cont.parentNode.parentNode.parentNode.parentNode._isWindow==true);if (isWindow)var winCell = this.cont.parentNode.parentNode.parentNode.parentNode;}catch(e){};if (isWindow && typeof(winCell)!= "undefined") {this.cont.style.display = "none";if (kx > 0 || ky > 0)winCell._adjustToContent(kx+10,ky+10);this.cont.style.display = "";isWindow = winCell = null;return;}
};_dhxForm_isIPad = (navigator.userAgent.search(/iPad/gi)>=0);dhtmlXForm.prototype.load = function(url, type, callback) {var form = this;form.callEvent("onXLS",[]);if (typeof type == 'function'){callback = type;type = 'xml';}
 
 dhtmlxAjax.get(url, function(loader){var data ={};if (type == "json"){eval("data="+loader.xmlDoc.responseText);}else {var top = loader.doXPath("//data")[0];if (top && top.getAttribute("dhx_security"))
 dhtmlx.security_key = top.getAttribute("dhx_security");var tags = loader.doXPath("//data/*");for (var i=0;i < tags.length;i++){data[tags[i].tagName] = tags[i].firstChild?tags[i].firstChild.nodeValue:"";};}
 
 var id = url.match(/(\?|\&)id\=([a-z0-9_]*)/i);if (id && id[0])id = id[0].split("=")[1];if (form.callEvent("onBeforeDataLoad", [id, data])){form.formId = id;form._last_load_data = data;form.setFormData(data);form.resetDataProcessor("updated");}
 
 
 form.callEvent("onXLE",[]);if (callback)callback.call(this);});};dhtmlXForm.prototype.reset = function() {if (this.callEvent("onBeforeReset",[this.formId,this.getFormData()])){if (this._last_load_data)this.setFormData(this._last_load_data);this.callEvent("onAfterReset", [this.formId]);}
};dhtmlXForm.prototype.send = function(url, mode, callback, skipValidation) {if (typeof mode == 'function'){callback = mode;mode = 'post';}
 if (skipValidation !== true && !this.validate()) return;var formdata = this.getFormData(true);var data = [];for (var key in formdata)data.push(key+"="+encodeURIComponent(formdata[key]));var afterload = function(loader){if (callback)callback.call(this, loader, loader.xmlDoc.responseText);};if (mode == 'get')dhtmlxAjax.get(url+(url.indexOf("?")==-1?"?":"&")+data.join("&"), afterload);else
 dhtmlxAjax.post(url, data.join("&"), afterload);};dhtmlXForm.prototype.save = function(url, type){};dhtmlXForm.prototype.dummy = function() {};dhtmlXForm.prototype._changeFormId = function(oldid, newid) {this.formId = newid;};dhtmlXForm.prototype._dp_init = function(dp) {dp._methods=["dummy","dummy","_changeFormId","dummy"];dp._getRowData=function(id,pref){var data = this.obj.getFormData(true);data[this.action_param] = this.obj.getUserData(id, this.action_param);return data;};dp._clearUpdateFlag=function(){};dp.attachEvent("onAfterUpdate",function(sid, action, tid, tag){if (action == "inserted" || action == "updated"){this.obj.resetDataProcessor("updated");this.obj._last_load_data = this.obj.getFormData(true);}
 this.obj.callEvent("onAfterSave",[this.obj.formId, tag]);return true;});dp.autoUpdate = false;dp.setTransactionMode("POST", true);this.dp = dp;this.formId = (new Date()).valueOf();this.resetDataProcessor("inserted");this.save = function(){if (!this.callEvent("onBeforeSave",[this.formId, this.getFormData()])) return;if (!this.validate()) return;dp.sendData();};};dhtmlXForm.prototype.resetDataProcessor=function(mode){if (!this.dp)return;this.dp.updatedRows = [];this.dp._in_progress = [];this.dp.setUpdated(this.formId,true,mode);};if (!window.dhtmlxValidation){dhtmlxValidation = function(){};dhtmlxValidation.prototype = {isEmpty: function(value) {return value == '';},
 isNotEmpty: function(value) {return !value == '';},
 isValidBoolean: function(value) {return !!value.match(/^(0|1|true|false)$/);},
 isValidEmail: function(value) {return !!value.match(/(^[a-z]([a-z0-9_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\-\.]*)(\.[a-z]{2,3})$)/i);},
 isValidInteger: function(value) {return !!value.match(/(^-?\d+$)/);},
 isValidNumeric: function(value) {return !!value.match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/);},
 isValidAplhaNumeric: function(value) {return !!value.match(/^[_\-a-z0-9]+$/gi);},
 
 isValidDatetime: function(value) {var dt = value.match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);return dt && !!(dt[1]<=9999 && dt[2]<=12 && dt[3]<=31 && dt[4]<=59 && dt[5]<=59 && dt[6]<=59) || false;},
 
 isValidDate: function(value) {var d = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);return d && !!(d[1]<=9999 && d[2]<=12 && d[3]<=31) || false;},
 
 isValidTime: function(value) {var t = value.match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);return t && !!(t[1]<=24 && t[2]<=59 && t[3]<=59) || false;},
 
 isValidIPv4: function(value) {var ip = value.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);return ip && !!(ip[1]<=255 && ip[2]<=255 && ip[3]<=255 && ip[4]<=255) || false;},
 isValidCurrency: function(value) {return value.match(/^\$?\s?\d+?[\.,\,]?\d+?\s?\$?$/) && true || false;},
 
 isValidSSN: function(value) {return value.match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false;},
 
 isValidSIN: function(value) {return value.match(/^\d{9}$/) && true || false;}
 };dhtmlxValidation = new dhtmlxValidation();};dhtmlXForm.prototype.items.calendar = {render: function(item, data) {var t = this;item._type = "calendar";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea calendar");this.doAttachChangeLS(item);item.childNodes[item._ll?1:0].childNodes[0]._idd = item._idd;item._f = (data.dateFormat||"%d-%m-%Y");item._f0 = (data.serverDateFormat||item._f);item._c = new dhtmlXCalendarObject(item.childNodes[item._ll?1:0].childNodes[0], data.skin||item.getForm().skin||"dhx_skyblue");item._c._nullInInput = true;item._c.enableListener(item.childNodes[item._ll?1:0].childNodes[0]);item._c.setDateFormat(item._f);if (!data.enableTime)item._c.hideTime();if (!isNaN(data.weekStart)) item._c.setWeekStartDay(data.weekStart);if (typeof(data.calendarPosition)!= "undefined") item._c.setPosition(data.calendarPosition);item._c._itemIdd = item._idd;item._c.attachEvent("onBeforeChange", function(d) {if (item._value != d){if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange",[item._idd, item._value, d])!== true) {return false;}
 }
 
 item._value = d;t.setValue(item, d);item.callEvent("onChange", [this._itemIdd, item._value]);}
 return true;});this.setValue(item, data.value);return this;},
 
 getCalendar: function(item) {return item._c;},
 
 setSkin: function(item, skin) {item._c.setSkin(skin);},
 
 setValue: function(item, value) {if (!value || value == null || typeof(value)== "undefined" || value == "") {item._value = null;item.childNodes[item._ll?1:0].childNodes[0].value = "";}else {item._value = (value instanceof Date ? value : item._c._strToDate(value, item._f0));item.childNodes[item._ll?1:0].childNodes[0].value = item._c._dateToStr(item._value, item._f);}
 item._c.setDate(item._value);},
 
 getValue: function(item, asString) {var d = item._c.getDate();if (asString===true && d == null)return "";return (asString===true?item._c._dateToStr(d,item._f0):d);},
 
 destruct: function(item) {item._c.disableListener(item.childNodes[item._ll?1:0].childNodes[0]);item._c.unload();item._c = null;try {delete item._c;}catch(e){}
 
 item._f = null;try {delete item._f;}catch(e){}
 
 item._f0 = null;try {delete item._f0;}catch(e){}
 
 
 item.childNodes[item._ll?1:0].childNodes[0]._idd = null;this.d2(item);item = null;}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setFocus:1,getInput:1})dhtmlXForm.prototype.items.calendar[a] = dhtmlXForm.prototype.items.input[a];})();dhtmlXForm.prototype.items.calendar.doAttachChangeLS = dhtmlXForm.prototype.items.select.doAttachChangeLS;dhtmlXForm.prototype.items.calendar.d2 = dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getCalendar = function(name) {return this.doWithItem(name, "getCalendar");};dhtmlXForm.prototype.items.upload = {render: function(item, data) {item._type = "up";item._enabled = true;item._checked = true;item.className = data.position+(typeof(data.className)=="string"?" "+data.className:"");var k = document.createElement("DIV");item.appendChild(k);if (!isNaN(data.inputLeft)) item.style.left = parseInt(data.inputLeft)+"px";if (!isNaN(data.inputTop)) item.style.top = parseInt(data.inputTop)+"px";if (data.inputWidth != "auto")if (!isNaN(data.inputWidth)) k.style.width = parseInt(data.inputWidth)+"px";item._uploader = new dhtmlXFileUploader(k, data.swfPath||"", data.swfUrl||"", data.mode||null, data.swfLogs);item._uploader.setURL(data.url||"");item._uploader.callEvent = item.callEvent;if (typeof(data.autoStart)!= "undefined") item._uploader.setAutoStart(data.autoStart);if (typeof(data.autoRemove)!= "undefined") item._uploader.setAutoRemove(data.autoRemove);if (typeof(data.titleScreen)!= "undefined") item._uploader.enableTitleScreen(data.titleScreen);if (typeof(data.titleText)!= "undefined") item._uploader.setTitleText(data.titleText);if (data.hidden == true)this.hide(item);if (data.disabled == true)this.userDisable(item);if (!(data.inputHeight == "auto" || parseInt(data.inputHeight)== NaN))
 item._uploader.p_files.style.height = parseInt(data.inputHeight)+"px";return this;},
 
 destruct: function(item) {this.doUnloadNestedLists(item);item._uploader.unload();item._uploader = null;item._checked = null;item._enabled = null;item._idd = null;item._type = null;item.onselectstart = null;item._autoCheck = null;item.callEvent = null;item.checkEvent = null;item.getForm = null;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);item = null;},
 
 setText: function(item, text) {},
 
 getText: function(item) {},
 
 enable: function(item) {item._enabled = true;if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._uploader.enable();},
 
 disable: function(item) {item._enabled = false;if (String(item.className).search("disabled") < 0) item.className += " disabled";item._uploader.disable();},
 
 setWidth: function(item, width) {item.childNodes[0].style.width = width+"px";item._width = width;},
 
 getWidth: function(item) {return item._width||parseInt(item.childNodes[0].style.width);},
 
 setValue: function(item) {item._uploader.clear();},
 
 getValue: function(item) {var t = item._uploader.getData();var r = {};var i = 0;for (var a in t){r[item._idd+"_r_"+i] = t[a].realName;r[item._idd+"_s_"+i] = t[a].serverName;i++;}
 r[item._idd+"_count"] = i;return r;},
 
 getUploader: function(item) {return item._uploader;},
 
 getStatus: function(item) {return item._uploader.getStatus();}
};(function(){for (var a in {doUnloadNestedLists:1,isEnabled:1})dhtmlXForm.prototype.items.upload[a] = dhtmlXForm.prototype.items.checkbox[a];})();dhtmlXForm.prototype.setFormData_upload = function(name) {this.doWithItem(name, "setValue");};dhtmlXForm.prototype.getUploader = function(name) {return this.doWithItem(name, "getUploader");};dhtmlXForm.prototype.getUploaderStatus = function(name) {return this.doWithItem(name, "getStatus");};function dhtmlXFileUploader(p, swfPath, swfUrl, mode, swfLogs) {var that = this;if (typeof(mode)== "string" && typeof(this[mode]) == "function") {this.engine = mode;}else {this.engine = "html4";if (typeof(window.FormData)!= "undefined" && typeof(window.XMLHttpRequest) != "undefined" && typeof(window.XMLHttpRequestUpload) != "undefined") {this.engine = "html5";}else if (typeof(window.swfobject)!= "undefined") {var k = swfobject.getFlashPlayerVersion();if (k.major >= 10)this.engine = "flash";}
 }
 
 if (typeof(p)== "string") p = document.getElementById(p);this._swf_file_url = swfPath||"";this._swf_upolad_url = swfUrl||"";this._swf_logs = swfLogs;this.p = document.createElement("DIV");this.p.className += " dhx_file_uploader";p.appendChild(this.p);this.p_files = document.createElement("DIV");this.p_files.className = "dhx_upload_files";this.p.appendChild(this.p_files);this.p_controls = document.createElement("DIV");this.p_controls.className = "dhx_upload_controls";this.p.appendChild(this.p_controls);this._files = {};this._items = {};this._data = {};this._autoStart = false;this._autoRemove = false;this._titleScreen = true;this._enabled = true;this._uploaded_count = 0;this._uid = function() {if (!this._idd)this._idd = new Date().getTime();else this._idd++;return this._idd;}
 
 this._initToolbar = function() {this.b_opts = {info: {onclick: null },
 browse: {onclick: null, tooltip: "Browse" },
 upload: {onclick: function() {if (!that._enabled)return;if (!that._uploading){that._switchButton(true);that._uploadStart();}}, tooltip: "Upload" },
 cancel: {onclick: function() {if (!that._enabled)return;that._uploadStop();that._switchButton(false);}, tooltip: "Stop" },
 clear: {onclick: function() {if (!that._enabled)return;that.clear();}, tooltip: "Clear list" }
 };this.buttons = {};for (var a in this.b_opts){var k = document.createElement("DIV");k.innerHTML = "&nbsp;";k.className = "dhx_file_uploader_button button_"+a;k.onclick = this.b_opts[a].onclick;if (this.b_opts[a].tooltip)k.title = this.b_opts[a].tooltip;this.p_controls.appendChild(k);this.buttons[a] = k;k = null;}
 
 this.buttons["cancel"].style.display = "none";}
 
 this._readableSize = function(t) {var i = false;var b = ["b","Kb","Mb","Gb","Tb","Pb","Eb"];for (var q=0;q<b.length;q++)if (t > 1024)t = t / 1024;else if (i === false)i = q;if (i === false)i = b.length-1;return Math.round(t*100)/100+" "+b[i];}
 
 this._addFileToList = function(id, name, size, state, progress) {this._checkTitleScreen();var t = document.createElement("DIV");t._idd = id;t.className = "dhx_file dhx_file_"+state;t.innerHTML = "<div class='dhx_file_param dhx_file_name'>&nbsp;</div>"+
 "<div class='dhx_file_param dhx_file_progress'>"+progress+"%</div>"+
 "<div class='dhx_file_param dhx_file_delete' title='Remove from list'>&nbsp;</div>";this.p_files.appendChild(t);t.childNodes[0].style.width = t.offsetWidth-127+"px";this._items[id] = t;this._updateFileNameSize(id);t.childNodes[2].onclick = function() {if (!that._enabled)return;var id = this.parentNode._idd;that._removeFileFromQueue(id);}
 }
 
 this._removeFileFromList = function(id) {if (!this._items[id])return;this._items[id].childNodes[2].onclick = null;this._items[id].parentNode.removeChild(this._items[id]);this._items[id] = null;delete this._items[id];if (this._data[id]){this._data[id] = null;delete this._data[id];}
 
 this._checkTitleScreen();}
 
 this._updateFileNameSize = function(id) {this._items[id].childNodes[0].innerHTML = this._files[id].name+(!isNaN(this._files[id].size)?" ("+this._readableSize(this._files[id].size)+")":"&nbsp;");this._items[id].childNodes[0].title = this._files[id].name+(!isNaN(this._files[id].size)?" ("+this._readableSize(this._files[id].size)+")":"");}
 
 this._updateFileInList = function(id, state, progress) {if (!this._items[id])return;this._items[id].className = "dhx_file dhx_file_"+state;if (state == "uploading" && progress < 100 && this._progress_type == "loader"){this._items[id].childNodes[1].className = "dhx_file_param dhx_file_uploading";this._items[id].childNodes[1].innerHTML = "&nbsp;";}else {this._items[id].childNodes[1].className = "dhx_file_param dhx_file_progress";this._items[id].childNodes[1].innerHTML = progress+"%";}
 this._updateFileNameSize(id);}
 
 this._removeFilesByState = function(state) {for (var a in this._files){if (state === true || this._files[a].state == state){this._removeFileFromQueue(a);}
 }
 }
 
 this._switchButton = function(state) {if (state == true){this.buttons["upload"].style.display = "none";this.buttons["cancel"].style.display = "";}else {var t = this._uploaded_count;this.buttons["upload"].style.display = "";this.buttons["cancel"].style.display = "none";this._uploaded_count = 0;if (t > 0)this.callEvent("onUploadComplete",[t]);}
 }
 
 this._uploadStart = function() {if (!this._uploading){for (var a in this._files){if (this._files[a].state == "fail"){this._files[a].state = "added";this._updateFileInList(a, "added", 0);}
 }
 }
 
 this._uploading = true;var t = false;for (var a in this._files){if (!t && [this._files[a].state] == "added"){t = true;this._files[a].state = "uploading";this._updateFileInList(a, "uploading", 0);this._doUploadFile(a);}
 }
 if (!t){this._uploading = false;this._switchButton(false);}
 
 }
 
 this._onUploadSuccess = function(id, serverName, r) {try {eval("var t="+r.data);}catch(e){};if (typeof(t)!= "undefined" && t.state == true && t.name != null) serverName = t.name;this._uploaded_count++;this._data[id] = {realName: this._files[id].name, serverName: serverName};this._files[id].state = "uploaded";this._updateFileInList(id, "uploaded", 100);this.callEvent("onUploadFile", [this._files[id].name,serverName]);if (this._autoRemove)this._removeFileFromQueue(id);if (this._uploading)this._uploadStart();}
 
 this._onUploadFail = function(id) {this._files[id].state = "fail";this._updateFileInList(id, "fail", 0);this.callEvent("onUploadFail", [this._files[id].name]);if (this._uploading)this._uploadStart();}
 
 this._onUploadAbort = function(id) {this._uploading = false;this._files[id].state = "added";this._updateFileInList(id, "added", 0);this.callEvent("onUploadCancel",[this._files[id].name]);}
 
 this._checkTitleScreen = function() {var k = 0;for (var a in this._files)k++;if (k == 0 && this.p.className.search("dhx_file_uploader_title")< 0 && this._titleScreen) {this.p.className += " dhx_file_uploader_title";this.buttons["info"].innerHTML = this._titleText;this.buttons["info"].style.width = Math.max(this.p_controls.offsetWidth-134, 0)+"px";}
 if ((k > 0 || !this._titleScreen)&& this.p.className.search("dhx_file_uploader_title") >= 0) {this.p.className = this.p.className.replace(/dhx_file_uploader_title/g,"");this.buttons["info"].innerHTML = "";}
 }
 
 
 this.callEvent = function(){}
 
 
 this.upload = function() {if (!this._uploading)this._uploadStart();}
 
 this.setAutoStart = function(state) {this._autoStart = (state==true);}
 
 this.setAutoRemove = function(state) {this._autoRemove = (state==true);}
 
 this.enableTitleScreen = function(state) {this._titleScreen = (state==true);this._checkTitleScreen();}
 
 this.setTitleText = function(text) {this._titleText = text;if (this.p.className.search("dhx_file_uploader_title")>= 0) this.buttons["info"].innerHTML = this._titleText;}
 
 this.setURL = function(url) {this._url = url;}
 
 this.setSWFURL = function(url) {this._swf_upolad_url = url;}
 
 this.enable = function() {this._enabled = true;this.p_files.className = "dhx_upload_files";this.p_controls.className = "dhx_upload_controls";}
 
 this.disable = function() {this._enabled = false;this.p_files.className = "dhx_upload_files dhx_uploader_dis";this.p_controls.className = "dhx_upload_controls dhx_uploader_dis";}
 
 this.getStatus = function() {var t = 0;for (var a in this._files){if (this._files[a].state != "uploaded")return -1;t = 1;}
 return t;}
 
 this.getData = function() {return this._data;}
 
 this.clear = function() {if (this._uploading)that._uploadStop();that._switchButton(false);that._removeFilesByState(true);this.callEvent("onClear",[]);}
 
 this.unload = function() {this._removeFilesByState(true);this._data = null;this._files = null;this._items = null;this._unloadEngine();for (var a in this.buttons){this.buttons[a].onclick = null;this.buttons[a].parentNode.removeChild(this.buttons[a]);this.buttons[a] = null;delete this.buttons[a];}
 this.buttons = null;for (var a in this.b_opts){this.b_opts[a].onclick = null;this.b_opts[a] = null;delete this.b_opts[a];}
 this.b_opts = null;this.p_controls.parentNode.removeChild(this.p_controls);this.p_controls = null;this.p_files.parentNode.removeChild(this.p_files);this.p_files = null;this._autoRemove = null;this._autoStart = null;this._enabled = null;this._progress_type = null;this._titleScreen = null;this._titleText = null;this._uploaded_count = null;this._url = null;this._uploading = null;this._idd = null;this._uid = null;this._initToolbar = null;this._readableSize = null;this._addFileToList = null;this._removeFileFromList = null;this._updateFileNameSize = null;this._updateFileInList = null;this._removeFilesByState = null;this._switchButton = null;this._uploadStart = null;this._onUploadSuccess = null;this._onUploadFail = null;this._onUploadAbort = null;this._checkTitleScreen = null;this.callEvent = null;this.upload = null;this.setAutoStart = null;this.setAutoRemove = null;this.enableTitleScreen = null;this.setTitleText = null;this.setURL = null;this.enable = null;this.disable = null;this.getStatus = null;this.getData = null;this.clear = null;this.unload = null;this._swf_file_url = null;this._swf_upolad_url = null;this.engine = null;this.p.className = this.p.className.replace(/dhx_file_uploader_title/gi,"").replace(/dhx_file_uploader/gi,"");this.p = null;that = a = null;}
 
 
 var e = new this[this.engine]();for (var a in e){this[a] = e[a];e[a] = null;}
 a = e = p = null;this._initToolbar();this._initEngine();this._checkTitleScreen();return this;}
dhtmlXFileUploader.prototype.html5 = function(){};dhtmlXFileUploader.prototype.html5.prototype = {_initEngine: function() {var that = this;this.buttons["browse"].onclick = function(){if (that._enabled)that.f.click();}
 
 this._progress_type = "percentage";this.f = document.createElement("INPUT");this.f.type = "file";this.f.multiple = "1";this.f.className = "dhx_uploader_input";this.p_controls.appendChild(this.f);this.f.onchange = function() {that._parseFilesInInput(this.files);}
 
 
 
 this.p.ondragenter = function(e){if (!e.dataTransfer)return;e.stopPropagation();e.preventDefault();}
 this.p.ondragover = function(e){if (!e.dataTransfer)return;e.stopPropagation();e.preventDefault();}
 this.p.ondrop = function(e) {if (!e.dataTransfer)return;e.stopPropagation();e.preventDefault();if (that._enabled)that._parseFilesInInput(e.dataTransfer.files);}
 
 this._titleText = "Drag-n-Drop files here or<br> click to select files for upload.";},

 _doUploadFile: function(id) {var that = this;if (!this._loader){this._loader = new XMLHttpRequest();this._loader.upload.onprogress = function(e) {if (that._files[this._idd].state == "uploading")that._updateFileInList(this._idd, "uploading", Math.round(e.loaded*100/e.total));}
 this._loader.onload = function(e) {try {eval("var r="+this.responseText);}catch(e){};if (typeof(r)== "object" && typeof(r.state) != "undefined" && r.state == true) {that._onUploadSuccess(this._idd, r.name);r = null;}else {that._onUploadFail(this._idd);}
 }
 this._loader.onerror = function(e) {that._onUploadFail(this._idd);}
 this._loader.onabort = function(e) {that._onUploadAbort(this._idd);}
 }
 
 this._loader._idd = id;this._loader.upload._idd = id;var form = new FormData();form.append("file", this._files[id].file);this._loader.open("POST", this._url+(String(this._url).indexOf("?")<0?"?":"&")+"mode=html5&"+new Date().getTime(), true);this._loader.setRequestHeader("X-Requested-With", "XMLHttpRequest");this._loader.send(form);},
 
 _uploadStop: function() {if (!this._uploading || !this._loader)return;this._loader.abort();},
 
 _parseFilesInInput: function(f) {for (var q=0;q<f.length;q++)this._addFileToQueue(f[q]);},
 
 _addFileToQueue: function(f) {var id = (f._idd||this._uid());this._files[id] = {file: f, name: f.name, size: f.size, state: "added"};this._addFileToList(id, f.name, f.size, "added", 0);if (this._autoStart && !this._uploading)this._uploadStart(true);},
 
 _removeFileFromQueue: function(id) {if (!this._files[id])return;var name = this._files[id].name;var serverName = (this._data!=null&&this._data[id]!=null?this._data[id].serverName:null);var k = false;if (this._uploading && id == this._loader._idd && this._files[id].state == "uploading"){this._uploadStop();k = true;}
 
 this._files[id].file = null;this._files[id].name = null;this._files[id].size = null;this._files[id].state = null;this._files[id] = null;delete this._files[id];this._removeFileFromList(id);this.callEvent("onFileRemove",[name,serverName]);if (k)this._uploadStart();},
 
 _unloadEngine: function() {this.buttons["browse"].onclick = null;this.f.onchange = null;this.f.parentNode.removeChild(this.f);this.f = null;this.p.ondragenter = null;this.p.ondragover = null;this.p.ondrop = null;if (this._loader){this._loader.upload.onprogress = null;this._loader.onload = null;this._loader.onerror = null;this._loader.onabort = null;this._loader._idd = null;this._loader.upload._idd = null;this._loader = null;}
 
 this._initEngine = null;this._doUploadFile = null;this._uploadStop = null;this._parseFilesInInput = null;this._addFileToQueue = null;this._removeFileFromQueue = null;this._unloadEngine = null;}
 
};dhtmlXFileUploader.prototype.html4 = function(){};dhtmlXFileUploader.prototype.html4.prototype = {_initEngine: function() {this._addForm();this._progress_type = "loader";this._titleText = "Click button<br>to select files for upload.";},
 
 _addForm: function() {var that = this;var id = this._uid();if (!this.k){this.k = document.createElement("DIV");this.k.className = "dhx_file_form_cont";this.buttons["browse"].appendChild(this.k);this.fr_name = "dhx_file_"+new Date().getTime();this.k.innerHTML = '<iframe name="'+this.fr_name+'" style="height:0px;width:0px;" frameBorder="0"></iframe>';this.fr = this.k.firstChild;if (window.navigator.userAgent.indexOf("MSIE")>= 0) {this.fr.onreadystatechange = function() {if (this.readyState == "complete")that._onLoad();}
 }else {this.fr.onload = function() {that._onLoad();}
 }
 
 }
 
 var f = document.createElement("DIV");f.innerHTML = "<form method='POST' enctype='multipart/form-data' target='"+this.fr_name+"' class='dhx_file_form' name='dhx_file_form_"+new Date().getTime()+"'>"+
 "<input type='hidden' name='mode' value='html4'>"+
 "<input type='hidden' name='uid' value='"+id+"'>"+
 "<input type='file' name='file' class='dhx_file_input'>"+
 "</form>";this.k.appendChild(f);f.firstChild.lastChild._idd = id;f.firstChild.lastChild.onchange = function(){that._addFileToQueue(this);this.onchange = null;this.parentNode.parentNode.style.display = "none";that._addForm();}
 
 f = null;},
 
 _onLoad: function() {if (this._uploading){try {eval("var r="+this.fr.contentWindow.document.body.innerHTML);}catch(e){};if (typeof(r)== "object") {if (typeof(r.state)!= "undefined") {if (r.state == "cancelled"){this._onUploadAbort(this.fr._idd);}else if (r.state == true){if (typeof(r.size)!= "undefined" && !isNaN(r.size)) this._files[this.fr._idd].size = r.size;this._onUploadSuccess(this.fr._idd, r.name);}
 r = null;return;}
 }
 this._onUploadFail(this.fr._idd);}
 
 },
 
 _addFileToQueue: function(t) {var v = t.value.match(/[^\\\/]*$/g);if (v[0] != null)v = v[0];else v = t.value;this._files[t._idd] = {name: v, form: t.parentNode, node: t.parentNode.parentNode, input: t, state: "added"};this._addFileToList(t._idd, t.value, false, "added", 0);},
 
 _removeFileFromQueue: function(id) {var name = this._files[id].name;var serverName = (this._data!=null&&this._data[id]!=null?this._data[id].serverName:null);this._files[id].input.onchange = null;this._files[id].form.removeChild(this._files[id].input);this._files[id].node.removeChild(this._files[id].form);this._files[id].node.parentNode.removeChild(this._files[id].node);this._files[id].input = null;this._files[id].name = null;this._files[id].form = null;this._files[id].node = null;this._files[id].size = null;this._files[id].state = null;this._files[id] = null;delete this._files[id];this._removeFileFromList(id);this.callEvent("onFileRemove",[name,serverName]);},
 
 _doUploadFile: function(id) {this.fr._idd = id;this._files[id].form.action = this._url;this._files[id].form.submit();},
 
 _uploadStop: function() {if (!this._uploading)return;this.fr.contentWindow.location.href = (this._url)+(this._url.indexOf("?")<0?"?":"&")+"mode=html4&action=cancel&etc="+new Date().getTime();},
 
 _unloadEngine: function() {if (this.k){this.fr_name = null;this.fr.onreadystatechange = null;this.fr.onload = null;this.fr.parentNode.removeChild(this.fr);this.fr = null;this.k.firstChild.firstChild.lastChild.onchange = null;this.k.parentNode.removeChild(this.k);this.k = null;}
 
 this._initEngine = null;this._addForm = null;this._onLoad = null;this._addFileToQueue = null;this._removeFileFromQueue = null;this._doUploadFile = null;this._uploadStop = null;this._unloadEngine = null;}
 
};dhtmlXFileUploader.prototype.flash = function(){};dhtmlXFileUploader.prototype.flash.prototype = {_initEngine: function() {if (!window.dhtmlXFileUploaderSWFObjects){window.dhtmlXFileUploaderSWFObjects = {items: {},
 uid: function() {if (!this.id)this.id = new Date().getTime();else this.id++;return this.id;},
 callEvent: function(id, name, params) {window.dhtmlXFileUploaderSWFObjects.items[id].uploader[name].apply(window.dhtmlXFileUploaderSWFObjects.items[id].uploader,params);}
 };}
 
 var that = this;this._swf_obj_id = "dhtmlXFileUploaderSWFObject_"+window.dhtmlXFileUploaderSWFObjects.uid();this._swf_file_url = this._swf_file_url+(this._swf_file_url.indexOf("?")>=0?"&":"?")+"etc="+new Date().getTime();this.buttons["browse"].innerHTML = "<div id='"+this._swf_obj_id+"' style='width:100%;height:100%;'></div>";swfobject.embedSWF(this._swf_file_url, this._swf_obj_id, "100%", "100%", "9", null, {ID:this._swf_obj_id,enableLogs:this._swf_logs}, {wmode:"transparent"});var v = swfobject.getFlashPlayerVersion();this._titleText = "Engine successfuly inited<br>Flash Player: "+v.major+"."+v.minor+"."+v.release;this._progress_type = "percentage";window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id] = {id: this._swf_obj_id, uploader: this};},
 
 _addFileToQueue: function(id, name, size) {this._files[id] = {name: name, size: size, state: "added"};this._addFileToList(id, name, size, "added", 0);if (this._autoStart && !this._uploading)this._uploadStart(true);},
 
 _removeFileFromQueue: function(id) {if (!this._files[id])return;var name = this._files[id].name;var serverName = (this._data!=null&&this._data[id]!=null?this._data[id].serverName:null);var k = false;if (this._uploading && this._files[id].state == "uploading"){this._uploadStop();k = true;}
 
 swfobject.getObjectById(this._swf_obj_id).removeFileById(id);this._files[id].name = null;this._files[id].size = null;this._files[id].state = null;this._files[id] = null;delete this._files[id];this._removeFileFromList(id);this.callEvent("onFileRemove",[name,serverName]);if (k)this._uploadStart();},
 
 _doUploadFile: function(id) {swfobject.getObjectById(this._swf_obj_id).upload(id, this._swf_upolad_url);},
 
 _uploadStop: function(id) {for (var a in this._files)if (this._files[a].state == "uploading")swfobject.getObjectById(this._swf_obj_id).uploadStop(a);},
 
 _unloadEngine: function() {if (window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]){window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].id = null;window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].uploader = null;window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id] = null
 delete window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id];}
 
 this._swf_obj_id = null;this._initEngine = null;this._addFileToQueue = null;this._removeFileFromQueue = null;this._doUploadFile = null;this._uploadStop = null;this._unloadEngine = null;}
 
};dhtmlXForm.prototype.items.colorpicker = {ev: false,
 
 
 inp: null,
 
 
 colorpicker: {},
 
 
 cz: {},
 
 render: function(item, data) {var t = this;item._type = "colorpicker";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, "INPUT", "TEXT", true, true, "dhxform_textarea");this.doAttachChangeLS(item);item._value = (data.value||"");item.childNodes[item._ll?1:0].childNodes[0].value = item._value;this.cz[item._idd] = document.createElement("DIV");this.cz[item._idd].style.position = "absolute";this.cz[item._idd].style.top = "0px";this.cz[item._idd].style.zIndex = 249;document.body.insertBefore(this.cz[item._idd], document.body.firstChild);this.colorpicker[item._idd] = new dhtmlXColorPicker(this.cz[item._idd], null, null, true);this.colorpicker[item._idd].setImagePath(data.imagePath||"");this.colorpicker[item._idd].init();this.colorpicker[item._idd].elements.cs_Content.onclick = function(e){(e||event).cancelBubble=true;}
 
 
 this.colorpicker[item._idd].setOnSelectHandler(function(color){if (item._value != color){if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange",[item._idd, item._value, color])!== true) {return;}
 }
 
 item._value = color;t.setValue(item, color);item.callEvent("onChange", [item._idd, item._value]);}
 });item.childNodes[item._ll?1:0].childNodes[0]._idd = item._idd;item.childNodes[item._ll?1:0].childNodes[0].onclick = function(){if (t.colorpicker[this._idd].isVisible()) {t.colorpicker[this._idd].hide();t.inp = null;}else {t.colorpicker[this._idd].setPosition(getAbsoluteLeft(this), getAbsoluteTop(this)+this.offsetHeight-1);t.colorpicker[this._idd].setColor(item._value);t.colorpicker[this._idd].show();t.inp = this._idd;}
 }
 
 if (!this.ev){if (_isIE)document.body.attachEvent("onclick",this.clickEvent);else window.addEventListener("click",this.clickEvent,false);this.ev = true;}
 
 return this;},
 
 clickEvent: function() {dhtmlXForm.prototype.items.colorpicker.hideAllColorPickers();},
 
 hideAllColorPickers: function() {for (var a in this.colorpicker)if (a != this.inp)this.colorpicker[a].hide();this.inp = null;},
 
 getColorPicker: function(item) {return this.colorpicker[item._idd];},
 
 destruct: function(item) {this.colorpicker[item._idd].elements.cs_Content.onclick = null;this.colorpicker[item._idd].unload();this.colorpicker[item._idd] = null;try {delete this.colorpicker[item._idd];}catch(e){}
 
 this.cz[item._idd].parentNode.removeChild(this.cz[item._idd]);this.cz[item._idd] = null;try {delete this.cz[item._idd];}catch(e){}
 
 
 var k = 0;for (var a in this.colorpicker)k++;if (k == 0){if (_isIE)document.body.detachEvent("onclick",this.clickEvent);else window.removeEventListener("click",this.clickEvent,false);this.ev = false;}
 
 
 item.childNodes[item._ll?1:0].childNodes[0]._idd = null;this.d2(item);item = null;}
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setValue:1,getValue:1,setFocus:1,getInput:1})dhtmlXForm.prototype.items.colorpicker[a] = dhtmlXForm.prototype.items.input[a];})();dhtmlXForm.prototype.items.colorpicker.doAttachChangeLS = dhtmlXForm.prototype.items.select.doAttachChangeLS;dhtmlXForm.prototype.items.colorpicker.d2 = dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getColorPicker = function(name) {return this.doWithItem(name, "getColorPicker");};dhtmlXColorPicker.prototype.unload = function() {this.elements.cs_SelectorVer.parentNode.removeChild(this.elements.cs_SelectorVer);this.elements.cs_SelectorHor.parentNode.removeChild(this.elements.cs_SelectorHor);this.elements.cs_SelectorVer = null;this.elements.cs_SelectorHor = null;this.elements.cs_SelectorDiv.ondblclick = null;this.elements.cs_SelectorDiv.onmousedown = null;this.elements.cs_SelectorDiv.z = null;this.elements.cs_SelectorDiv.parentNode.removeChild(this.elements.cs_SelectorDiv);this.elements.cs_SelectorDiv = null;this.elements.cs_LumSelectArrow.onmousedown = null;this.elements.cs_LumSelectArrow.z = null;this.elements.cs_LumSelectArrow.parentNode.removeChild(this.elements.cs_LumSelectArrow);this.elements.cs_LumSelectArrow = null;this.elements.cs_LumSelectLine.parentNode.removeChild(this.elements.cs_LumSelectLine);this.elements.cs_LumSelectLine = null;while (this.elements.cs_LumSelect.childNodes.length > 0)this.elements.cs_LumSelect.removeChild(this.elements.cs_LumSelect.childNodes[0]);this.elements.cs_LumSelect.ondblclick = null;this.elements.cs_LumSelect.onmousedown = null;this.elements.cs_LumSelect.z = null;this.elements.cs_LumSelect.parentNode.removeChild(this.elements.cs_LumSelect);this.elements.cs_LumSelect = null;this.elements.cs_EndColor.parentNode.removeChild(this.elements.cs_EndColor);this.elements.cs_EndColor = null;this.elements.cs_InputHue.onchange = null;this.elements.cs_InputHue.z = null;this.elements.cs_InputHue.parentNode.removeChild(this.elements.cs_InputHue);this.elements.cs_InputHue = null;this.elements.cs_InputRed.onchange = null;this.elements.cs_InputRed.z = null;this.elements.cs_InputRed.parentNode.removeChild(this.elements.cs_InputRed);this.elements.cs_InputRed = null;this.elements.cs_InputSat.onchange = null;this.elements.cs_InputSat.z = null;this.elements.cs_InputSat.parentNode.removeChild(this.elements.cs_InputSat);this.elements.cs_InputSat = null;this.elements.cs_InputGreen.onchange = null;this.elements.cs_InputGreen.z = null;this.elements.cs_InputGreen.parentNode.removeChild(this.elements.cs_InputGreen);this.elements.cs_InputGreen = null;this.elements.cs_Hex.onchange = null;this.elements.cs_Hex.z = null;this.elements.cs_Hex.parentNode.removeChild(this.elements.cs_Hex);this.elements.cs_Hex = null;this.elements.cs_InputLum.onchange = null;this.elements.cs_InputLum.z = null;this.elements.cs_InputLum.parentNode.removeChild(this.elements.cs_InputLum);this.elements.cs_InputLum = null;this.elements.cs_InputBlue.onchange = null;this.elements.cs_InputBlue.z = null;this.elements.cs_InputBlue.parentNode.removeChild(this.elements.cs_InputBlue);this.elements.cs_InputBlue = null;this.elements.cs_ButtonOk.onclick = null;this.elements.cs_ButtonOk.onmouseout = null;this.elements.cs_ButtonOk.onmouseover = null;this.elements.cs_ButtonOk.z = null;this.elements.cs_ButtonOk.parentNode.removeChild(this.elements.cs_ButtonOk);this.elements.cs_ButtonOk = null;this.elements.cs_ButtonCancel.onclick = null;this.elements.cs_ButtonCancel.onmouseout = null;this.elements.cs_ButtonCancel.onmouseover = null;this.elements.cs_ButtonCancel.z = null;this.elements.cs_ButtonCancel.parentNode.removeChild(this.elements.cs_ButtonCancel);this.elements.cs_ButtonCancel = null;this.elements.cs_ContentTable.parentNode.removeChild(this.elements.cs_ContentTable);this.elements.cs_ContentTable = null;this.elements.cs_Content.parentNode.removeChild(this.elements.cs_Content);this.elements.cs_Content = null;this.z = null;this.detachAllEvents();this.attachEvent = null;this.callEvent = null;this.checkEvent = null;this.eventCatcher = null;this.detachEvent = null;this.detachAllEvents = null;this.generate = null;this.resetHandlers = null;this.clickOk = null;this.clickCancel = null;this.saveColor = null;this.restoreColor = null;this.addCustomColor = null;this.restoreFromRGB = null;this.restoreFromHSV = null;this.restoreFromHEX = null;this.redraw = null;this.setCustomColors = null;this.setColor = null;this.close = null;this.setPosition = null;this.hide = null;this.setOnSelectHandler = null;this.setOnCancelHandler = null;this.getSelectedColor = null;this.linkTo = null;this.hideOnSelect = null;this.setImagePath = null;this.init = null;this.loadUserLanguage = null;this.setSkin = null;this.isVisible = null;this.hoverButton = null;this.normalButton = null;this.show = null;this.showA = null;this.unload = null;this._initCsIdElement = null;this._initEvents = null;this._setCrossPos = null;this._getScrollers = null;this._setLumPos = null;this._startMoveColor = null;this._mouseMoveColor = null;this._stopMoveColor = null;this._startMoveLum = null;this._mouseMoveLum = null;this._stopMoveLum = null;this._getOffset = null;this._getOffsetTop = null;this._getOffsetLeft = null;this._calculateColor = null;this._drawValues = null;this._hsv2rgb = null;this._rgb2hsv = null;this._drawLum = null;this._colorizeLum = null;this._dec2hex = null;this._hex2dec = null;this._initCustomColors = null;this._reinitCustomColors = null;this._getColorHEX = null;this._selectCustomColor = null;this._changeValueHSV = null;this._changeValueRGB = null;this._changeValueHEX = null;this.container = null;this.elements = null;this.language = null;this.linkToObjects = null;this.customColors = null;};dhtmlXForm.prototype.items.combo = {render: function(item, data) {item._type = "combo";item._enabled = true;item._value = null;item._newValue = null;this.doAddLabel(item, data);this.doAddInput(item, data, "SELECT", null, true, true, "dhxform_select");this.doAttachEvents(item);this.doLoadOpts(item, data);item.onselectstart = function(e){e=e||event;e.returnValue=true;return true;}
 
 
 item.childNodes[item._ll?1:0].childNodes[0].setAttribute("opt_type", data.comboType||"");item._combo = new dhtmlXComboFromSelect(item.childNodes[item._ll?1:0].childNodes[0]);item._combo._currentComboValue = item._combo.getSelectedValue();item._combo.DOMelem_input.id = data.uid;if (data.connector){var that = this;item._connector_working = true;item._combo.loadXML(data.connector, function(){item.callEvent("onOptionsLoaded", [item._idd]);item._connector_working = false;if (item._connector_value != null){that.setValue(item, item._connector_value);item._connector_value = null;}
 });}
 if (data.filtering)item._combo.enableFilteringMode(true);if (data.readonly == true)this.setReadonly(item, true);if (data.style)item._combo.DOMelem_input.style.cssText += data.style;if (typeof(window.addEventListener)== "function" && item.getForm().skin == "dhx_terrace") {item._combo.DOMelem_input.addEventListener("focus", function(){var k = this.parentNode.parentNode;k._inFocus = true;if (k.className.search(/combo_in_focus/)< 0) k.className += " combo_in_focus";k = null;}, false);item._combo.DOMelem_input.addEventListener("blur", function(){var k = this.parentNode.parentNode;if (k.className.search(/combo_in_focus/)>= 0) k.className = k.className.replace(/combo_in_focus/gi,"");k = null;}, false);}
 
 return this;},
 
 destruct: function(item) {item.childNodes[item._ll?1:0].childNodes[0].onchange = null;item._combo._currentComboValue = null;item._combo.destructor();item._combo = null;item._apiChange = null;this.d2(item);item = null;},
 
 doAttachEvents: function(item) {var that = this;item.childNodes[item._ll?1:0].childNodes[0].onchange = function() {that.doOnChange(this);that.doValidate(this.DOMParent.parentNode.parentNode);}
 },
 
 doValidate: function(item) {if (item.getForm().hot_validate) this._validate(item);},
 
 doOnChange: function(combo) {var item = combo.DOMParent.parentNode.parentNode;if (item._apiChange)return;combo._newComboValue = combo.getSelectedValue();if (combo._newComboValue != combo._currentComboValue){if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange", [item._idd, combo._currentComboValue, combo._newComboValue])!== true) {window.setTimeout(function(){combo.setComboValue(combo._currentComboValue);},1);return false;}
 }
 combo._currentComboValue = combo._newComboValue;item.callEvent("onChange", [item._idd, combo._currentComboValue]);}
 item._autoCheck(item._enabled);},
 
 enable: function(item) {if (String(item.className).search("disabled") >= 0) item.className = String(item.className).replace(/disabled/gi,"");item._enabled = true;item._combo.disable(false);item._combo.DOMelem_button.src = (window.dhx_globalImgPath?dhx_globalImgPath:"")+'combo_select'+(dhtmlx.skin?"_"+dhtmlx.skin:"")+'.gif';},
 
 disable: function(item) {if (String(item.className).search("disabled") < 0) item.className += " disabled";item._enabled = false;item._combo.disable(true);item._combo.DOMelem_button.src = (window.dhx_globalImgPath?dhx_globalImgPath:"")+'combo_select_dis'+(dhtmlx.skin?"_"+dhtmlx.skin:"")+'.gif';},
 
 getCombo: function(item) {return item._combo;},
 
 setValue: function(item, val) {if (item._connector_working){item._connector_value = val;return;}
 item._apiChange = true;item._combo.setComboValue(val);item._combo._currentComboValue = item._combo.getActualValue();item._apiChange = false;},
 
 getValue: function(item) {return item._combo.getActualValue();},
 
 setWidth: function(item, width) {item.childNodes[item._ll?1:0].childNodes[0].style.width = width+"px";},
 
 setReadonly: function(item, state) {if (!item._combo)return;item._combo_ro = state;item._combo.readonly(item._combo_ro);},

 isReadonly: function(item, state) {return item._combo_ro||false;},
 
 _setCss: function(item, skin, fontSize) {item._combo.DOMlist.style.fontSize = fontSize;}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doLoadOpts:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,_checkNoteWidth:1})dhtmlXForm.prototype.items.combo[a] = dhtmlXForm.prototype.items.select[a];})();dhtmlXForm.prototype.items.combo.d2 = dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.getCombo = function(name) {return this.doWithItem(name, "getCombo");};dhtmlXForm.prototype.items.editor = {editor: {},
 
 render: function(item, data) {var ta = (!isNaN(data.rows));item._type = "editor";item._enabled = true;this.doAddLabel(item, data);this.doAddInput(item, data, "DIV", null, true, true, "dhxform_item_template");item._value = (data.value||"");item.childNodes[item._ll?1:0].childNodes[0].className += " dhxeditor_inside";var that = this;this.editor[item._idd] = new dhtmlXEditor(item.childNodes[item._ll?1:0].childNodes[0]);this.editor[item._idd].setContent(item._value);this.editor[item._idd].attachEvent("onAccess",function(t, ev){_dhxForm_doClick(document.body, "click");if (t == "blur")that.doOnBlur(item, this);item.callEvent("onEditorAccess", [item._idd, t, ev, this, item.getForm()]);});this.editor[item._idd].attachEvent("onToolbarClick", function(a){item.callEvent("onEditorToolbarClick", [item._idd, a, this, item.getForm()]);});if (data.readonly)this.setReadonly(item, true);item.childNodes[item._ll?0:1].childNodes[0].removeAttribute("for");item.childNodes[item._ll?0:1].childNodes[0].onclick = function() {that.editor[item._idd]._focus();}
 
 
 return this;},
 
 
 
 doOnBlur: function(item, editor) {var t = editor.getContent();if (item._value != t){if (item.checkEvent("onBeforeChange")) {if (item.callEvent("onBeforeChange",[item._idd, item._value, t])!== true) {editor.setContent(item._value);return;}
 }
 
 item._value = t;item.callEvent("onChange",[item._idd, t]);}
 },
 
 setValue: function(item, value) {if (item._value == value)return;item._value = value;this.editor[item._idd].setContent(item._value);},
 
 getValue: function(item) {item._value = this.editor[item._idd].getContent();return item._value;},
 
 enable: function(item) {this.editor[item._idd].setReadonly(false);this.doEn(item);},
 
 disable: function(item) {this.editor[item._idd].setReadonly(true);this.doDis(item);},
 
 setReadonly: function(item, mode) {this.editor[item._idd].setReadonly(mode);},
 
 getEditor: function(item) {return (this.editor[item._idd]||null);},
 
 destruct: function(item) {item.childNodes[item._ll?0:1].childNodes[0].onclick = null;this.editor[item._idd].unload();this.editor[item._idd] = null;this.d2(item);item = null;},
 
 setFocus: function(item) {this.editor[item._idd]._focus();}
 
};(function(){for (var a in {doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,setWidth:1,isEnabled:1})dhtmlXForm.prototype.items.editor[a] = dhtmlXForm.prototype.items.template[a];})();dhtmlXForm.prototype.items.editor.d2 = dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.items.editor.doEn = dhtmlXForm.prototype.items.select.enable;dhtmlXForm.prototype.items.editor.doDis = dhtmlXForm.prototype.items.select.disable;dhtmlXForm.prototype.getEditor = function(name) {return this.doWithItem(name, "getEditor");};var globalActiveDHTMLGridObject;String.prototype._dhx_trim=function(){return this.replace(/&nbsp;/g, " ").replace(/(^[ \t]*)|([ \t]*$)/g, "");}
function dhtmlxArray(ar){return dhtmlXHeir((ar||new Array()), dhtmlxArray._master);};dhtmlxArray._master={_dhx_find:function(pattern){for (var i = 0;i < this.length;i++){if (pattern == this[i])return i;}
 return -1;},
 _dhx_insertAt:function(ind, value){this[this.length]=null;for (var i = this.length-1;i >= ind;i--)this[i]=this[i-1]
 this[ind]=value
 },
 _dhx_removeAt:function(ind){this.splice(ind,1)
 },
 _dhx_swapItems:function(ind1, ind2){var tmp = this[ind1];this[ind1]=this[ind2]
 this[ind2]=tmp;}
}
function dhtmlXGridObject(id){if (_isIE)try{document.execCommand("BackgroundImageCache", false, true);}
 catch (e){}
 if (id){if (typeof (id)== 'object'){this.entBox=id
 if (!this.entBox.id)this.entBox.id="cgrid2_"+this.uid();}else
 this.entBox=document.getElementById(id);}else {this.entBox=document.createElement("DIV");this.entBox.id="cgrid2_"+this.uid();}
 this.entBox.innerHTML="";dhtmlxEventable(this);var self = this;this._wcorr=0;this.fontWidth = 7;this.cell=null;this.row=null;this.iconURL="";this.editor=null;this._f2kE=true;this._dclE=true;this.combos=new Array(0);this.defVal=new Array(0);this.rowsAr={};this.rowsBuffer=dhtmlxArray();this.rowsCol=dhtmlxArray();this._data_cache={};this._ecache={}
 this._ud_enabled=true;this.xmlLoader=new dtmlXMLLoaderObject(this.doLoadDetails, this, true, this.no_cashe);this._maskArr=[];this.selectedRows=dhtmlxArray();this.UserData={};this._sizeFix=this._borderFix=0;this.entBox.className+=" gridbox";this.entBox.style.width=this.entBox.getAttribute("width")
 ||(window.getComputedStyle
 ? (this.entBox.style.width||window.getComputedStyle(this.entBox, null)["width"])
 : (this.entBox.currentStyle
 ? this.entBox.currentStyle["width"]
 : this.entBox.style.width||0))
 ||"100%";this.entBox.style.height=this.entBox.getAttribute("height")
 ||(window.getComputedStyle
 ? (this.entBox.style.height||window.getComputedStyle(this.entBox, null)["height"])
 : (this.entBox.currentStyle
 ? this.entBox.currentStyle["height"]
 : this.entBox.style.height||0))
 ||"100%";this.entBox.style.cursor='default';this.entBox.onselectstart=function(){return false
 };var t_creator=function(name){var t=document.createElement("TABLE");t.cellSpacing=t.cellPadding=0;t.style.cssText='width:100%;table-layout:fixed;';t.className=name.substr(2);return t;}
 this.obj=t_creator("c_obj");this.hdr=t_creator("c_hdr");this.hdr.style.marginRight="20px";this.hdr.style.paddingRight="20px";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.overflow="auto";this.objBox.appendChild(this.obj);this.objBox.className="objbox";this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%"
 this.hdrBox.style.height="25px";this.hdrBox.style.overflow="hidden";this.hdrBox.className="xhdr";this.preloadImagesAr=new Array(0)

 this.sortImg=document.createElement("IMG")
 this.sortImg.style.display="none";this.hdrBox.appendChild(this.sortImg)
 this.hdrBox.appendChild(this.hdr);this.hdrBox.style.position="relative";this.entBox.appendChild(this.hdrBox);this.entBox.appendChild(this.objBox);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=[];this.cellWidthPC=[];this.cellWidthType=this.entBox.cellwidthtype||"px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=[];this.columnIds=[];this.columnColor=[];this._hrrar=[];this.cellType=dhtmlxArray();this.cellAlign=[];this.initCellWidth=[];this.fldSort=[];this._srdh=(_isIE && (document.compatMode != "BackCompat") ? 22 : 20);this.imgURL=window.dhx_globalImgPath||"";this.isActive=false;this.isEditable=true;this.useImagesInHeader=false;this.pagingOn=false;this.rowsBufferOutSize=0;dhtmlxEvent(window, "unload", function(){try{if (self.destructor)self.destructor();}
 catch (e){}
 });this.setSkin=function(name){this.skin_name=name;var classname = this.entBox.className.split(" gridbox")[0];this.entBox.className=classname + " gridbox gridbox_"+name;this.skin_h_correction=0;this.enableAlterCss("ev_"+name, "odd_"+name, this.isTreeGrid())
 this._fixAlterCss()

 switch (name){case "clear":
 this._topMb=document.createElement("DIV");this._topMb.className="topMumba";this._topMb.innerHTML="<img style='left:0px' src='"+this.imgURL
 +"skinC_top_left.gif'><img style='right:20px' src='"+this.imgURL+"skinC_top_right.gif'>";this.entBox.appendChild(this._topMb);this._botMb=document.createElement("DIV");this._botMb.className="bottomMumba";this._botMb.innerHTML="<img style='left:0px' src='"+this.imgURL
 +"skinD_bottom_left.gif'><img style='right:20px' src='"+this.imgURL+"skinD_bottom_right.gif'>";this.entBox.appendChild(this._botMb);if (this.entBox.style.position != "absolute")this.entBox.style.position="relative";this.skin_h_correction=20;break;case "white":
 this._srdh=40;this.forceDivInHeader=true;break;case "dhx_skyblue":
 case "dhx_web":
 case "glassy_blue":
 case "dhx_black":
 case "dhx_blue":
 case "modern":
 case "light":
 this._srdh=20;this.forceDivInHeader=true;break;case "xp":
 this.forceDivInHeader=true;if ((_isIE)&&(document.compatMode != "BackCompat"))
 this._srdh=26;else this._srdh=22;break;case "mt":
 if ((_isIE)&&(document.compatMode != "BackCompat"))
 this._srdh=26;else this._srdh=22;break;case "gray":
 if ((_isIE)&&(document.compatMode != "BackCompat"))
 this._srdh=22;break;case "sbdark":
 break;}
 if (_isIE&&this.hdr){var d = this.hdr.parentNode;d.removeChild(this.hdr);d.appendChild(this.hdr);}
 this.setSizes();}
 if (_isIE)this.preventIECaching(true);if (window.dhtmlDragAndDropObject)this.dragger=new dhtmlDragAndDropObject();this._doOnScroll=function(e, mode){this.callEvent("onScroll", [
 this.objBox.scrollLeft,
 this.objBox.scrollTop
 ]);this.doOnScroll(e, mode);}
 
 this.doOnScroll=function(e, mode){this.hdrBox.scrollLeft=this.objBox.scrollLeft;if (this.ftr)this.ftr.parentNode.scrollLeft=this.objBox.scrollLeft;if (mode)return;if (this._srnd){if (this._dLoadTimer)window.clearTimeout(this._dLoadTimer);this._dLoadTimer=window.setTimeout(function(){if (self._update_srnd_view)self._update_srnd_view();}, 100);}
 }
 
 this.attachToObject=function(obj){obj.appendChild(this.globalBox?this.globalBox:this.entBox);this.setSizes();}
 
 this.init=function(fl){if ((this.isTreeGrid())&&(!this._h2)){this._h2=new dhtmlxHierarchy();if ((this._fake)&&(!this._realfake))
 this._fake._h2=this._h2;this._tgc={imgURL: null
 };}
 if (!this._hstyles)return;this.editStop()
 
 this.lastClicked=null;this.resized=null;this.fldSorted=this.r_fldSorted=null;this.cellWidthPX=[];this.cellWidthPC=[];if (this.hdr.rows.length > 0){this.clearAll(true);}
 var hdrRow = this.hdr.insertRow(0);for (var i = 0;i < this.hdrLabels.length;i++){hdrRow.appendChild(document.createElement("TH"));hdrRow.childNodes[i]._cellIndex=i;hdrRow.childNodes[i].style.height="0px";}
 if (_isIE && _isIE<8)hdrRow.style.position="absolute";else
 hdrRow.style.height='auto';var hdrRow = this.hdr.insertRow(_isKHTML ? 2 : 1);hdrRow._childIndexes=new Array();var col_ex = 0;for (var i = 0;i < this.hdrLabels.length;i++){hdrRow._childIndexes[i]=i-col_ex;if ((this.hdrLabels[i] == this.splitSign)&&(i != 0)){if (_isKHTML)hdrRow.insertCell(i-col_ex);hdrRow.cells[i-col_ex-1].colSpan=(hdrRow.cells[i-col_ex-1].colSpan||1)+1;hdrRow.childNodes[i-col_ex-1]._cellIndex++;col_ex++;hdrRow._childIndexes[i]=i-col_ex;continue;}
 hdrRow.insertCell(i-col_ex);hdrRow.childNodes[i-col_ex]._cellIndex=i;hdrRow.childNodes[i-col_ex]._cellIndexS=i;this.setColumnLabel(i, this.hdrLabels[i]);}
 if (col_ex == 0)hdrRow._childIndexes=null;this._cCount=this.hdrLabels.length;if (_isIE)window.setTimeout(function(){if (self.setSizes)self.setSizes();}, 1);if (!this.obj.firstChild)this.obj.appendChild(document.createElement("TBODY"));var tar = this.obj.firstChild;if (!tar.firstChild){tar.appendChild(document.createElement("TR"));tar=tar.firstChild;if (_isIE && _isIE<8)tar.style.position="absolute";else
 tar.style.height='auto';for (var i = 0;i < this.hdrLabels.length;i++){tar.appendChild(document.createElement("TH"));tar.childNodes[i].style.height="0px";}
 }
 this._c_order=null;if (this.multiLine != true)this.obj.className+=" row20px";this.sortImg.style.position="absolute";this.sortImg.style.display="none";this.sortImg.src=this.imgURL+"sort_desc.gif";this.sortImg.defLeft=0;if (this.noHeader){this.hdrBox.style.display='none';}
 else {this.noHeader=false
 }
 this.attachHeader();this.attachHeader(0, 0, "_aFoot");this.setSizes();if (fl)this.parseXML()
 this.obj.scrollTop=0

 if (this.dragAndDropOff)this.dragger.addDragLanding(this.entBox, this);if (this._initDrF)this._initD();if (this._init_point)this._init_point();};this.setColumnSizes=function(gridWidth){var summ = 0;var fcols = [];var fix = 0;for (var i = 0;i < this._cCount;i++){if ((this.initCellWidth[i] == "*")&& !this._hrrar[i]){this._awdth=false;fcols.push(i);continue;}
 if (this.cellWidthType == '%'){if (typeof this.cellWidthPC[i]=="undefined")this.cellWidthPC[i]=this.initCellWidth[i];var cwidth = (gridWidth*this.cellWidthPC[i]/100)||0;if (fix>0.5){cwidth++;fix--;}
 var rwidth = this.cellWidthPX[i]=Math.floor(cwidth);var fix =fix + cwidth - rwidth;}else{if (typeof this.cellWidthPX[i]=="undefined")this.cellWidthPX[i]=this.initCellWidth[i];}
 if (!this._hrrar[i])summ+=this.cellWidthPX[i]*1;}
 
 if (fcols.length){var ms = Math.floor((gridWidth-summ)/fcols.length);if (ms < 0)ms=1;for (var i = 0;i < fcols.length;i++){var next=Math.max((this._drsclmW ? (this._drsclmW[fcols[i]]||0) : 0),ms)
 this.cellWidthPX[fcols[i]]=next;summ+=next;}
 
 if(gridWidth > summ){var last=fcols[fcols.length-1];this.cellWidthPX[last]=this.cellWidthPX[last] + (gridWidth-summ);summ = gridWidth;}
 
 this._setAutoResize();}
 
 
 this.obj.style.width=summ+"px";this.hdr.style.width=summ+"px";if (this.ftr)this.ftr.style.width=summ+"px";this.chngCellWidth();return summ;}
 
 
 this.setSizes=function(){if ((!this.hdr.rows[0])) return;var quirks=this.quirks = (_isIE && document.compatMode=="BackCompat");var outerBorder=(this.entBox.offsetWidth-this.entBox.clientWidth)/2;if (!this.dontSetSizes){if (this.globalBox){var splitOuterBorder=(this.globalBox.offsetWidth-this.globalBox.clientWidth)/2;if (this._delta_x && !this._realfake){var ow = this.globalBox.clientWidth;this.globalBox.style.width=this._delta_x;this.entBox.style.width=Math.max(0,(this.globalBox.clientWidth+(quirks?splitOuterBorder*2:0))-this._fake.entBox.clientWidth)+"px";if (ow != this.globalBox.clientWidth){this._fake._correctSplit(this._fake.entBox.clientWidth);}
 }
 if (this._delta_y && !this._realfake){this.globalBox.style.height = this._delta_y;this.entBox.style.overflow = this._fake.entBox.style.overflow="hidden";this.entBox.style.height = this._fake.entBox.style.height=this.globalBox.clientHeight+(quirks?splitOuterBorder*2:0)+"px";}
 }else {if (this._delta_x){if (this.entBox.parentNode && this.entBox.parentNode.tagName=="TD"){this.entBox.style.width="1px";this.entBox.style.width=parseInt(this._delta_x)*this.entBox.parentNode.clientWidth/100-outerBorder*2+"px";}else
 this.entBox.style.width=this._delta_x;}
 if (this._delta_y)this.entBox.style.height=this._delta_y;}
 }
 
 
 window.clearTimeout(this._sizeTime);if (!this.entBox.offsetWidth && (!this.globalBox || !this.globalBox.offsetWidth)){this._sizeTime=window.setTimeout(function(){if (self.setSizes)self.setSizes();}, 250);return;}
 
 var border_x = ((!this._wthB) && ((this.entBox.cmp||this._delta_x) && (this.skin_name||"").indexOf("dhx")==0 && !quirks)?2:0);var border_y = ((!this._wthB) && ((this.entBox.cmp||this._delta_y) && (this.skin_name||"").indexOf("dhx")==0 && !quirks)?2:0);var isVScroll = this.parentGrid?false:(this.objBox.scrollHeight > this.objBox.offsetHeight);var scrfix = _isFF?18:18;var gridWidth=this.entBox.clientWidth-(this.skin_h_correction||0)*(quirks?0:1)-border_x;var gridWidthActive=this.entBox.clientWidth-(this.skin_h_correction||0)-border_x;var gridHeight=this.entBox.clientHeight-border_y;var summ=this.setColumnSizes(gridWidthActive-(isVScroll?scrfix:0)-(this._correction_x||0));var isHScroll = this.parentGrid?false:((this.objBox.scrollWidth > this.objBox.offsetWidth)||(this.objBox.style.overflowX=="scroll"));var headerHeight = this.hdr.clientHeight;var footerHeight = this.ftr?this.ftr.clientHeight:0;var newWidth=gridWidth;var newHeight=gridHeight-headerHeight-footerHeight;if (this._awdth && this._awdth[0] && this._awdth[1]==99999)isHScroll=0;if (this._ahgr){if (this._ahgrMA)newHeight=this.entBox.parentNode.clientHeight-headerHeight-footerHeight;else
 newHeight=this.obj.offsetHeight+(isHScroll?scrfix:0)+(this._correction_y||0);if (this._ahgrM){if (this._ahgrF)newHeight=Math.min(this._ahgrM,newHeight+headerHeight+footerHeight)-headerHeight-footerHeight;else 
 newHeight=Math.min(this._ahgrM,newHeight);}
 if (isVScroll && newHeight>=this.obj.scrollHeight+(isHScroll?scrfix:0)){isVScroll=false;this.setColumnSizes(gridWidthActive-(this._correction_x||0));}
 }
 
 if ((this._awdth)&&(this._awdth[0])){if (this.cellWidthType == '%')this.cellWidthType="px";if (this._fake)summ+=this._fake.entBox.clientWidth;var newWidth=Math.min(Math.max(summ+(isVScroll?scrfix:0),this._awdth[2]),this._awdth[1])+(this._correction_x||0);if (this._fake)newWidth-=this._fake.entBox.clientWidth;}
 newHeight=Math.max(0,newHeight);this._ff_size_delta=(this._ff_size_delta==0.1)?0.2:0.1;if (!_isFF)this._ff_size_delta=0;if (!this.dontSetSizes){this.entBox.style.width=Math.max(0,newWidth+(quirks?2:0)*outerBorder+this._ff_size_delta)+"px";this.entBox.style.height=newHeight+(quirks?2:0)*outerBorder+headerHeight+footerHeight+"px";}
 this.objBox.style.height=newHeight+((quirks&&!isVScroll)?2:0)*outerBorder+"px";this.hdrBox.style.height=headerHeight+"px";if (newHeight != gridHeight)this.doOnScroll(0, !this._srnd);var ext=this["setSizes_"+this.skin_name];if (ext)ext.call(this);this.setSortImgPos();if (headerHeight != this.hdr.clientHeight && this._ahgr)this.setSizes();this.callEvent("onSetSizes",[]);};this.setSizes_clear=function(){var y=this.hdr.offsetHeight;var x=this.entBox.offsetWidth;var y2=y+this.objBox.offsetHeight;this._topMb.style.top=(y||0)+"px";this._topMb.style.width=(x+20)+"px";this._botMb.style.top=(y2-3)+"px";this._botMb.style.width=(x+20)+"px";};this.chngCellWidth=function(){if ((_isOpera)&&(this.ftr))
 this.ftr.width=this.objBox.scrollWidth+"px";var l = this._cCount;for (var i = 0;i < l;i++){this.hdr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px";this.obj.rows[0].childNodes[i].style.width=this.cellWidthPX[i]+"px";if (this.ftr)this.ftr.rows[0].cells[i].style.width=this.cellWidthPX[i]+"px";}
 }
 
 this.setDelimiter=function(delim){this.delim=delim;}
 
 this.setInitWidthsP=function(wp){this.cellWidthType="%";this.initCellWidth=wp.split(this.delim.replace(/px/gi, ""));if (!arguments[1])this._setAutoResize();}
 
 this._setAutoResize=function(){if (this._realfake)return;var el = window;var self = this;dhtmlxEvent(window,"resize",function(){window.clearTimeout(self._resize_timer);if (self._setAutoResize)self._resize_timer=window.setTimeout(function(){if (self.setSizes)self.setSizes();if (self._fake)self._fake._correctSplit();}, 100);})
 }
 
 this.setInitWidths=function(wp){this.cellWidthType="px";this.initCellWidth=wp.split(this.delim);if (_isFF){for (var i = 0;i < this.initCellWidth.length;i++)if (this.initCellWidth[i] != "*")this.initCellWidth[i]=parseInt(this.initCellWidth[i]);}
 }
 
 this.enableMultiline=function(state){this.multiLine=convertStringToBoolean(state);}
 
 this.enableMultiselect=function(state){this.selMultiRows=convertStringToBoolean(state);}
 
 this.setImagePath=function(path){this.imgURL=path;}
 this.setImagesPath=this.setImagePath;this.setIconPath=function(path){this.iconURL=path;}
 this.setIconsPath=this.setIconPath;this.changeCursorState=function(ev){var el = ev.target||ev.srcElement;if (el.tagName != "TD")el=this.getFirstParentOfType(el, "TD")
 if (!el)return;if ((el.tagName == "TD")&&(this._drsclmn)&&(!this._drsclmn[el._cellIndex]))
 return el.style.cursor="default";var check = (ev.layerX||0)+(((!_isIE)&&(ev.target.tagName == "DIV")) ? el.offsetLeft : 0);if ((el.offsetWidth-(ev.offsetX||(parseInt(this.getPosition(el, this.hdrBox))-check)*-1)) < (_isOpera?20:10)){el.style.cursor="E-resize";}
 else{el.style.cursor="default";}
 if (_isOpera)this.hdrBox.scrollLeft=this.objBox.scrollLeft;}
 
 this.startColResize=function(ev){if (this.resized)this.stopColResize();this.resized=null;var el = ev.target||ev.srcElement;if (el.tagName != "TD")el=this.getFirstParentOfType(el, "TD")
 var x = ev.clientX;var tabW = this.hdr.offsetWidth;var startW = parseInt(el.offsetWidth)

 if (el.tagName == "TD"&&el.style.cursor != "default"){if ((this._drsclmn)&&(!this._drsclmn[el._cellIndex]))
 return;self._old_d_mm=document.body.onmousemove;self._old_d_mu=document.body.onmouseup;document.body.onmousemove=function(e){if (self)self.doColResize(e||window.event, el, startW, x, tabW)
 }
 document.body.onmouseup=function(){if (self)self.stopColResize();}
 }
 }
 
 this.stopColResize=function(){document.body.onmousemove=self._old_d_mm||"";document.body.onmouseup=self._old_d_mu||"";this.setSizes();this.doOnScroll(0, 1)
 this.callEvent("onResizeEnd", [this]);}
 
 this.doColResize=function(ev, el, startW, x, tabW){el.style.cursor="E-resize";this.resized=el;var fcolW = startW+(ev.clientX-x);var wtabW = tabW+(ev.clientX-x)

 if (!(this.callEvent("onResize", [
 el._cellIndex,
 fcolW,
 this
 ])))
 return;if (_isIE)this.objBox.scrollLeft=this.hdrBox.scrollLeft;if (el.colSpan > 1){var a_sizes = new Array();for (var i = 0;i < el.colSpan;i++)a_sizes[i]=Math.round(fcolW*this.hdr.rows[0].childNodes[el._cellIndexS+i].offsetWidth/el.offsetWidth);for (var i = 0;i < el.colSpan;i++)this._setColumnSizeR(el._cellIndexS+i*1, a_sizes[i]);}else
 this._setColumnSizeR(el._cellIndex, fcolW);this.doOnScroll(0, 1);this.setSizes();if (this._fake && this._awdth)this._fake._correctSplit();}
 
 this._setColumnSizeR=function(ind, fcolW){if (fcolW > ((this._drsclmW&&!this._notresize)? (this._drsclmW[ind]||10) : 10)){this.obj.rows[0].childNodes[ind].style.width=fcolW+"px";this.hdr.rows[0].childNodes[ind].style.width=fcolW+"px";if (this.ftr)this.ftr.rows[0].childNodes[ind].style.width=fcolW+"px";if (this.cellWidthType == 'px'){this.cellWidthPX[ind]=fcolW;}
 else {var gridWidth = parseInt(this.entBox.offsetWidth);if (this.objBox.scrollHeight > this.objBox.offsetHeight)gridWidth-=17;var pcWidth = Math.round(fcolW / gridWidth*100)
 this.cellWidthPC[ind]=pcWidth;}
 if (this.sortImg.style.display!="none")this.setSortImgPos();}
 }
 
 this.setSortImgState=function(state, ind, order, row){order=(order||"asc").toLowerCase();if (!convertStringToBoolean(state)){this.sortImg.style.display="none";this.fldSorted=this.r_fldSorted = null;return;}
 if (order == "asc")this.sortImg.src=this.imgURL+"sort_asc.gif";else
 this.sortImg.src=this.imgURL+"sort_desc.gif";this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].childNodes[ind];var r = this.hdr.rows[row||1];if (!r)return;for (var i = 0;i < r.childNodes.length;i++){if (r.childNodes[i]._cellIndexS == ind){this.r_fldSorted=r.childNodes[i];return this.setSortImgPos();}
 }
 return this.setSortImgState(state,ind,order,(row||1)+1);}
 
 this.setSortImgPos=function(ind, mode, hRowInd, el){if (this._hrrar && this._hrrar[this.r_fldSorted?this.r_fldSorted._cellIndex:ind])return;if (!el){if (!ind)var el = this.r_fldSorted;else
 var el = this.hdr.rows[hRowInd||0].cells[ind];}
 if (el != null){var pos = this.getPosition(el, this.hdrBox)
 var wdth = el.offsetWidth;this.sortImg.style.left=Number(pos[0]+wdth-13)+"px";this.sortImg.defLeft=parseInt(this.sortImg.style.left)
 this.sortImg.style.top=Number(pos[1]+5)+"px";if ((!this.useImagesInHeader)&&(!mode))
 this.sortImg.style.display="inline";this.sortImg.style.left=this.sortImg.defLeft+"px";}
 }
 
 this.setActive=function(fl){if (arguments.length == 0)var fl = true;if (fl == true){if (globalActiveDHTMLGridObject&&(globalActiveDHTMLGridObject != this)){globalActiveDHTMLGridObject.editStop();globalActiveDHTMLGridObject.callEvent("onBlur",[globalActiveDHTMLGridObject]);}
 globalActiveDHTMLGridObject=this;this.isActive=true;}else {this.isActive=false;this.callEvent("onBlur",[this]);}
 };this._doClick=function(ev){var selMethod = 0;var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");if (!el)return;var fl = true;if (this.markedCells){var markMethod = 0;if (ev.shiftKey||ev.metaKey){markMethod=1;}
 if (ev.ctrlKey){markMethod=2;}
 this.doMark(el, markMethod);return true;}
 
 

 if (this.selMultiRows != false){if (ev.shiftKey && this.row != null && this.selectedRows.length){selMethod=1;}
 if (ev.ctrlKey||ev.metaKey){selMethod=2;}
 }
 this.doClick(el, fl, selMethod)
 };this._doContClick=function(ev){var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");if ((!el)||( typeof (el.parentNode.idd) == "undefined")){this.callEvent("onEmptyClick", [ev]);return true;}
 if (ev.button == 2||(_isMacOS&&ev.ctrlKey)){if (!this.callEvent("onRightClick", [
 el.parentNode.idd,
 el._cellIndex,
 ev
 ])){var z = function(e){(e||event).cancelBubble=true;return false;};(ev.srcElement||ev.target).oncontextmenu=z;return z(ev);}
 if (this._ctmndx){if (!(this.callEvent("onBeforeContextMenu", [
 el.parentNode.idd,
 el._cellIndex,
 this
 ])))
 return true;if (_isIE)ev.srcElement.oncontextmenu=function(){event.cancelBubble=true;return false;};if (this._ctmndx.showContextMenu){var dEl0=window.document.documentElement;var dEl1=window.document.body;var corrector = new Array((dEl0.scrollLeft||dEl1.scrollLeft),(dEl0.scrollTop||dEl1.scrollTop));if (_isIE){var x= ev.clientX+corrector[0];var y = ev.clientY+corrector[1];}else {var x= ev.pageX;var y = ev.pageY;}
 this._ctmndx.showContextMenu(x-1,y-1)
 this.contextID=this._ctmndx.contextMenuZoneId=el.parentNode.idd+"_"+el._cellIndex;this._ctmndx._skip_hide=true;}else {el.contextMenuId=el.parentNode.idd+"_"+el._cellIndex;el.contextMenu=this._ctmndx;el.a=this._ctmndx._contextStart;el.a(el, ev);el.a=null;}
 ev.cancelBubble=true;return false;}
 }
 else if (this._ctmndx){if (this._ctmndx.hideContextMenu)this._ctmndx.hideContextMenu()
 else
 this._ctmndx._contextEnd();}
 return true;}
 
 this.doClick=function(el, fl, selMethod, show){if (!this.selMultiRows)selMethod=0;var psid = this.row ? this.row.idd : 0;this.setActive(true);if (!selMethod)selMethod=0;if (this.cell != null)this.cell.className=this.cell.className.replace(/cellselected/g, "");if (el.tagName == "TD"){if (this.checkEvent("onSelectStateChanged"))
 var initial = this.getSelectedId();var prow = this.row;if (selMethod == 1){var elRowIndex = this.rowsCol._dhx_find(el.parentNode)
 var lcRowIndex = this.rowsCol._dhx_find(this.lastClicked)

 if (elRowIndex > lcRowIndex){var strt = lcRowIndex;var end = elRowIndex;}else {var strt = elRowIndex;var end = lcRowIndex;}
 for (var i = 0;i < this.rowsCol.length;i++)if ((i >= strt&&i <= end)){if (this.rowsCol[i]&&(!this.rowsCol[i]._sRow)){if (this.rowsCol[i].className.indexOf("rowselected")== -1&&this.callEvent("onBeforeSelect", [
 this.rowsCol[i].idd,
 psid
 ])){this.rowsCol[i].className+=" rowselected";this.selectedRows[this.selectedRows.length]=this.rowsCol[i]
 }
 }else {this.clearSelection();return this.doClick(el, fl, 0, show);}
 }
 }else if (selMethod == 2){if (el.parentNode.className.indexOf("rowselected")!= -1){el.parentNode.className=el.parentNode.className.replace(/rowselected/g, "");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode))
 var skipRowSelection = true;show = false;}
 }
 this.editStop()
 if (typeof (el.parentNode.idd)== "undefined")
 return true;if ((!skipRowSelection)&&(!el.parentNode._sRow)){if (this.callEvent("onBeforeSelect", [
 el.parentNode.idd,
 psid
 ])){if (this.getSelectedRowId()!= el.parentNode.idd){if (selMethod == 0)this.clearSelection();this.cell=el;if ((prow == el.parentNode)&&(this._chRRS))
 fl=false;this.row=el.parentNode;this.row.className+=" rowselected"
 
 if (this.cell && _isIE && _isIE == 8 ){var next = this.cell.nextSibling;var parent = this.cell.parentNode;parent.removeChild(this.cell)
 parent.insertBefore(this.cell,next);}
 
 if (this.selectedRows._dhx_find(this.row)== -1)
 this.selectedRows[this.selectedRows.length]=this.row;}else {this.cell=el;this.row = el.parentNode;}
 }else fl = false;}

 if (this.cell && this.cell.parentNode.className.indexOf("rowselected")!= -1)
 this.cell.className=this.cell.className.replace(/cellselected/g, "")+" cellselected";if (selMethod != 1)if (!this.row)return;this.lastClicked=el.parentNode;var rid = this.row.idd;var cid = this.cell;if (fl&& typeof (rid)!= "undefined" && cid && !skipRowSelection) {self.onRowSelectTime=setTimeout(function(){if (self.callEvent)self.callEvent("onRowSelect", [
 rid,
 cid._cellIndex
 ]);}, 100);}else this.callEvent("onRowSelectRSOnly",[rid]);if (this.checkEvent("onSelectStateChanged")){var afinal = this.getSelectedId();if (initial != afinal)this.callEvent("onSelectStateChanged", [afinal,initial]);}
 }
 this.isActive=true;if (show !== false && this.cell && this.cell.parentNode.idd)this.moveToVisible(this.cell)
 }
 
 this.selectAll=function(){this.clearSelection();var coll = this.rowsBuffer;if (this.pagingOn)coll = this.rowsCol;for (var i = 0;i<coll.length;i ++){this.render_row(i).className+=" rowselected";}
 
 this.selectedRows=dhtmlxArray([].concat(coll));if (this.selectedRows.length){this.row = this.selectedRows[0];this.cell = this.row.cells[0];}
 if ((this._fake)&&(!this._realfake))
 this._fake.selectAll();}
 
 this.selectCell=function(r, cInd, fl, preserve, edit, show){if (!fl)fl=false;if (typeof (r)!= "object")
 r=this.render_row(r)
 if (!r || r==-1)return null;var c = r.childNodes[cInd];if (!c)c=r.childNodes[0];if(!this.markedCells){if (preserve)this.doClick(c, fl, 3, show)
 else
 this.doClick(c, fl, 0, show)
 }
 else 
 this.doMark(c,preserve?2:0);if (edit)this.editCell();}
 
 this.moveToVisible=function(cell_obj, onlyVScroll){if (this.pagingOn){var newPage=Math.floor(this.getRowIndex(cell_obj.parentNode.idd) / this.rowsBufferOutSize)+1;if (newPage!=this.currentPage)this.changePage(newPage);}
 try{if (cell_obj.offsetHeight){var distance = cell_obj.offsetLeft+cell_obj.offsetWidth+20;var scrollLeft = 0;if (distance > (this.objBox.offsetWidth+this.objBox.scrollLeft)){if (cell_obj.offsetLeft > this.objBox.scrollLeft)scrollLeft=cell_obj.offsetLeft-5
 }else if (cell_obj.offsetLeft < this.objBox.scrollLeft){distance-=cell_obj.offsetWidth*2/3;if (distance < this.objBox.scrollLeft)scrollLeft=cell_obj.offsetLeft-5
 }
 
 if ((scrollLeft)&&(!onlyVScroll))
 this.objBox.scrollLeft=scrollLeft;}
 
 if (!cell_obj.offsetHeight){var mask=this._realfake?this._fake.rowsAr[cell_obj.parentNode.idd]:cell_obj.parentNode;distance = this.rowsBuffer._dhx_find(mask)*this._srdh;}
 else
 distance = cell_obj.offsetTop;var distancemax = distance + cell_obj.offsetHeight+38;if (distancemax > (this.objBox.offsetHeight+this.objBox.scrollTop)){var scrollTop = distancemax-this.objBox.offsetHeight;}else if (distance < this.objBox.scrollTop){var scrollTop = distance-5
 }
 if (scrollTop)this.objBox.scrollTop=scrollTop;}
 catch (er){}
 }
 
 this.editCell=function(){if (this.editor&&this.cell == this.editor.cell)return;this.editStop();if ((this.isEditable != true)||(!this.cell))
 return false;var c = this.cell;if (c.parentNode._locked)return false;this.editor=this.cells4(c);if (this.editor != null){if (this.editor.isDisabled()){this.editor=null;return false;}
 if (this.callEvent("onEditCell", [
 0,
 this.row.idd,
 this.cell._cellIndex
 ])!= false&&this.editor.edit){this._Opera_stop=(new Date).valueOf();c.className+=" editable";this.editor.edit();this.callEvent("onEditCell", [
 1,
 this.row.idd,
 this.cell._cellIndex
 ])
 }else {this.editor=null;}
 }
 }
 
 this.editStop=function(mode){if (_isOpera)if (this._Opera_stop){if ((this._Opera_stop*1+50)> (new Date).valueOf())
 return;this._Opera_stop=null;}
 if (this.editor&&this.editor != null){this.editor.cell.className=this.editor.cell.className.replace("editable", "");if (mode){var t = this.editor.val;this.editor.detach();this.editor.setValue(t);this.editor=null;this.callEvent("onEditCancel", [
 this.row.idd,
 this.cell._cellIndex,
 t
 ]);return;}
 if (this.editor.detach())
 this.cell.wasChanged=true;var g = this.editor;this.editor=null;var z = this.callEvent("onEditCell", [
 2,
 this.row.idd,
 this.cell._cellIndex,
 g.getValue(),
 g.val
 ]);if (( typeof (z)== "string")||( typeof (z) == "number"))
 g[g.setImage ? "setLabel" : "setValue"](z);else if (!z)g[g.setImage ? "setLabel" : "setValue"](g.val);if (this._ahgr && this.multiLine)this.setSizes();}
 }
 
 this._nextRowCell=function(row, dir, pos){row=this._nextRow((this._groups?this.rowsCol:this.rowsBuffer)._dhx_find(row), dir);if (!row)return null;return row.childNodes[row._childIndexes ? row._childIndexes[pos] : pos];}
 
 this._getNextCell=function(acell, dir, i){acell=acell||this.cell;var arow = acell.parentNode;if (this._tabOrder){i=this._tabOrder[acell._cellIndex];if (typeof i != "undefined")if (i < 0)acell=this._nextRowCell(arow, dir, Math.abs(i)-1);else
 acell=arow.childNodes[i];}else {var i = acell._cellIndex+dir;if (i >= 0&&i < this._cCount){if (arow._childIndexes)i=arow._childIndexes[acell._cellIndex]+dir;acell=arow.childNodes[i];}else {acell=this._nextRowCell(arow, dir, (dir == 1 ? 0 : (this._cCount-1)));}
 }
 if (!acell){if ((dir == 1)&&this.tabEnd){this.tabEnd.focus();this.tabEnd.focus();this.setActive(false);}
 if ((dir == -1)&&this.tabStart){this.tabStart.focus();this.tabStart.focus();this.setActive(false);}
 return null;}
 

 
 if (acell.style.display != "none"
 &&(!this.smartTabOrder||!this.cells(acell.parentNode.idd, acell._cellIndex).isDisabled()))
 return acell;return this._getNextCell(acell, dir);}
 
 this._nextRow=function(ind, dir){var r = this.render_row(ind+dir);if (!r || r==-1)return null;if (r&&r.style.display == "none")return this._nextRow(ind+dir, dir);return r;}
 
 this.scrollPage=function(dir){if (!this.rowsBuffer.length)return;var master = this._realfake?this._fake:this;var new_ind = Math.floor((master._r_select||this.getRowIndex(this.row.idd)||0)+(dir)*this.objBox.offsetHeight / (this._srdh||20));if (new_ind < 0)new_ind=0;if (new_ind >= this.rowsBuffer.length)new_ind=this.rowsBuffer.length-1;if (this._srnd && !this.rowsBuffer[new_ind]){this.objBox.scrollTop+=Math.floor((dir)*this.objBox.offsetHeight / (this._srdh||20))*(this._srdh||20);if (this._fake)this._fake.objBox.scrollTop = this.objBox.scrollTop;master._r_select=new_ind;}else {this.selectCell(new_ind, this.cell._cellIndex, true, false,false,(this.multiLine || this._srnd));if (!this.multiLine && !this._srnd && !this._realfake){this.objBox.scrollTop=this.getRowById(this.getRowId(new_ind)).offsetTop;if (this._fake)this._fake.objBox.scrollTop = this.objBox.scrollTop;}
 master._r_select=null;}
 }
 
 this.doKey=function(ev){if (!ev)return true;if ((ev.target||ev.srcElement).value !== window.undefined){var zx = (ev.target||ev.srcElement);if ((!zx.parentNode)||(zx.parentNode.className.indexOf("editable") == -1))
 return true;}
 if ((globalActiveDHTMLGridObject)&&(this != globalActiveDHTMLGridObject))
 return globalActiveDHTMLGridObject.doKey(ev);if (this.isActive == false){return true;}
 if (this._htkebl)return true;if (!this.callEvent("onKeyPress", [
 ev.keyCode,
 ev.ctrlKey,
 ev.shiftKey,
 ev
 ]))
 return false;var code = "k"+ev.keyCode+"_"+(ev.ctrlKey ? 1 : 0)+"_"+(ev.shiftKey ? 1 : 0);if (this.cell){if (this._key_events[code]){if (false === this._key_events[code].call(this))
 return true;if (ev.preventDefault)ev.preventDefault();ev.cancelBubble=true;return false;}
 if (this._key_events["k_other"])this._key_events.k_other.call(this, ev);}
 return true;}
 
 
 this.selectRow=function(r, fl, preserve, show){if (typeof (r)!= 'object')
 r=this.render_row(r);this.selectCell(r, 0, fl, preserve, false, show)
 };this.wasDblClicked=function(ev){var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");if (el){var rowId = el.parentNode.idd;return this.callEvent("onRowDblClicked", [
 rowId,
 el._cellIndex
 ]);}
 }
 
 this._onHeaderClick=function(e, el){var that = this.grid;el=el||that.getFirstParentOfType(_isIE ? event.srcElement : e.target, "TD");if (this.grid.resized == null){if (!(this.grid.callEvent("onHeaderClick", [
 el._cellIndexS,
 (e||window.event)])))
 return false;that.sortField(el._cellIndexS, false, el)

 }
 this.grid.resized = null;}
 
 this.deleteSelectedRows=function(){var num = this.selectedRows.length 

 if (num == 0)return;var tmpAr = this.selectedRows;this.selectedRows=dhtmlxArray()
 for (var i = num-1;i >= 0;i--){var node = tmpAr[i]

 if (!this.deleteRow(node.idd, node)){this.selectedRows[this.selectedRows.length]=node;}
 else {if (node == this.row){var ind = i;}
 }
 }
 if (ind){try{if (ind+1 > this.rowsCol.length)ind--;this.selectCell(ind, 0, true)
 }
 catch (er){this.row=null
 this.cell=null
 }
 }
 }
 
 this.getSelectedRowId=function(){var selAr = new Array(0);var uni = {};for (var i = 0;i < this.selectedRows.length;i++){var id = this.selectedRows[i].idd;if (uni[id])continue;selAr[selAr.length]=id;uni[id]=true;}
 
 if (selAr.length == 0)return null;else
 return selAr.join(this.delim);}
 
 
 this.getSelectedCellIndex=function(){if (this.cell != null)return this.cell._cellIndex;else
 return -1;}
 
 this.getColWidth=function(ind){return parseInt(this.cellWidthPX[ind]);}
 
 this.setColWidth=function(ind, value){if (value == "*")this.initCellWidth[ind] = "*";else {if (this._hrrar[ind])return;if (this.cellWidthType == 'px')this.cellWidthPX[ind]=parseInt(value);else
 this.cellWidthPC[ind]=parseInt(value);}
 this.setSizes();}
 
 this.getRowIndex=function(row_id){for (var i = 0;i < this.rowsBuffer.length;i++)if (this.rowsBuffer[i]&&this.rowsBuffer[i].idd == row_id)return i;return -1;}
 
 this.getRowId=function(ind){return this.rowsBuffer[ind] ? this.rowsBuffer[ind].idd : this.undefined;}
 
 this.setRowId=function(ind, row_id){this.changeRowId(this.getRowId(ind), row_id)
 }
 
 this.changeRowId=function(oldRowId, newRowId){if (oldRowId == newRowId)return;var row = this.rowsAr[oldRowId]
 row.idd=newRowId;if (this.UserData[oldRowId]){this.UserData[newRowId]=this.UserData[oldRowId]
 this.UserData[oldRowId]=null;}
 if (this._h2&&this._h2.get[oldRowId]){this._h2.get[newRowId]=this._h2.get[oldRowId];this._h2.get[newRowId].id=newRowId;delete this._h2.get[oldRowId];}
 this.rowsAr[oldRowId]=null;this.rowsAr[newRowId]=row;for (var i = 0;i < row.childNodes.length;i++)if (row.childNodes[i]._code)row.childNodes[i]._code=this._compileSCL(row.childNodes[i]._val, row.childNodes[i]);if (this._mat_links && this._mat_links[oldRowId]){var a=this._mat_links[oldRowId];delete this._mat_links[oldRowId];for (var c in a)for (var i=0;i < a[c].length;i++)this._compileSCL(a[c][i].original,a[c][i]);}
 
 this.callEvent("onRowIdChange",[oldRowId,newRowId]);}
 
 this.setColumnIds=function(ids){this.columnIds=ids.split(this.delim)
 }
 
 this.setColumnId=function(ind, id){this.columnIds[ind]=id;}
 
 this.getColIndexById=function(id){for (var i = 0;i < this.columnIds.length;i++)if (this.columnIds[i] == id)return i;}
 
 this.getColumnId=function(cin){return this.columnIds[cin];}
 
 
 this.getColumnLabel=function(cin, ind, hdr){var z = (hdr||this.hdr).rows[(ind||0)+1];for (var i=0;i<z.cells.length;i++)if (z.cells[i]._cellIndexS==cin)return (_isIE ? z.cells[i].innerText : z.cells[i].textContent);return "";};this.getColLabel = this.getColumnLabel;this.getFooterLabel=function(cin, ind){return this.getColumnLabel(cin,ind,this.ftr);}
 

 
 this.setRowTextBold=function(row_id){var r=this.getRowById(row_id)
 if (r)r.style.fontWeight="bold";}
 
 this.setRowTextStyle=function(row_id, styleString){var r = this.getRowById(row_id)
 if (!r)return;for (var i = 0;i < r.childNodes.length;i++){var pfix = r.childNodes[i]._attrs["style"]||"";if (_isIE)r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString;else
 r.childNodes[i].style.cssText=pfix+"width:"+r.childNodes[i].style.width+";"+styleString;}
 }
 
 this.setRowColor=function(row_id, color){var r = this.getRowById(row_id)

 for (var i = 0;i < r.childNodes.length;i++)r.childNodes[i].bgColor=color;}
 
 this.setCellTextStyle=function(row_id, ind, styleString){var r = this.getRowById(row_id)

 if (!r)return;var cell = r.childNodes[r._childIndexes ? r._childIndexes[ind] : ind];if (!cell)return;var pfix = "";if (_isIE)cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString;else
 cell.style.cssText=pfix+"width:"+cell.style.width+";"+styleString;}
 
 this.setRowTextNormal=function(row_id){var r=this.getRowById(row_id);if (r)r.style.fontWeight="normal";}
 
 this.doesRowExist=function(row_id){if (this.getRowById(row_id)!= null)
 return true
 else
 return false
 }
 


 
 this.getColumnsNum=function(){return this._cCount;}
 
 

 
 this.moveRowUp=function(row_id){var r = this.getRowById(row_id)

 if (this.isTreeGrid())
 return this.moveRowUDTG(row_id, -1);var rInd = this.rowsCol._dhx_find(r)
 if ((r.previousSibling)&&(rInd != 0)){r.parentNode.insertBefore(r, r.previousSibling)
 this.rowsCol._dhx_swapItems(rInd, rInd-1)
 this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd-1);if (this._cssEven)this._fixAlterCss(rInd-1);}
 }
 
 this.moveRowDown=function(row_id){var r = this.getRowById(row_id)

 if (this.isTreeGrid())
 return this.moveRowUDTG(row_id, 1);var rInd = this.rowsCol._dhx_find(r);if (r.nextSibling){this.rowsCol._dhx_swapItems(rInd, rInd+1)

 if (r.nextSibling.nextSibling)r.parentNode.insertBefore(r, r.nextSibling.nextSibling)
 else
 r.parentNode.appendChild(r)
 this.setSizes();var bInd=this.rowsBuffer._dhx_find(r);this.rowsBuffer._dhx_swapItems(bInd,bInd+1);if (this._cssEven)this._fixAlterCss(rInd);}
 }
 
 this.getCombo=function(col_ind){if (!this.combos[col_ind]){this.combos[col_ind]=new dhtmlXGridComboObject();}
 return this.combos[col_ind];}
 
 this.setUserData=function(row_id, name, value){if (!row_id)row_id="gridglobaluserdata";if (!this.UserData[row_id])this.UserData[row_id]=new Hashtable()
 this.UserData[row_id].put(name, value)
 }
 
 this.getUserData=function(row_id, name){if (!row_id)row_id="gridglobaluserdata";this.getRowById(row_id);var z = this.UserData[row_id];return (z ? z.get(name) : "");}
 
 this.setEditable=function(fl){this.isEditable=convertStringToBoolean(fl);}
 
 this.selectRowById=function(row_id, multiFL, show, call){if (!call)call=false;this.selectCell(this.getRowById(row_id), 0, call, multiFL, false, show);}
 
 
 this.clearSelection=function(){this.editStop()

 for (var i = 0;i < this.selectedRows.length;i++){var r = this.rowsAr[this.selectedRows[i].idd];if (r)r.className=r.className.replace(/rowselected/g, "");}
 
 this.selectedRows=dhtmlxArray()
 this.row=null;if (this.cell != null){this.cell.className=this.cell.className.replace(/cellselected/g, "");this.cell=null;}
 
 this.callEvent("onSelectionCleared",[]);}
 
 this.copyRowContent=function(from_row_id, to_row_id){var frRow = this.getRowById(from_row_id)

 if (!this.isTreeGrid())
 for (var i = 0;i < frRow.cells.length;i++){this.cells(to_row_id, i).setValue(this.cells(from_row_id, i).getValue())
 }
 else
 this._copyTreeGridRowContent(frRow, from_row_id, to_row_id);if (!_isIE)this.getRowById(from_row_id).cells[0].height=frRow.cells[0].offsetHeight
 }
 
 this.setFooterLabel=function(c, label, ind){return this.setColumnLabel(c,label,ind,this.ftr);};this.setColumnLabel=function(c, label, ind, hdr){var z = (hdr||this.hdr).rows[ind||1];var col = (z._childIndexes ? z._childIndexes[c] : c);if (!z.cells[col])return;if (!this.useImagesInHeader){var hdrHTML = "<div class='hdrcell'>"

 if (label.indexOf('img:[')!= -1){var imUrl = label.replace(/.*\[([^>]+)\].*/, "$1");label=label.substr(label.indexOf("]")+1, label.length)
 hdrHTML+="<img width='18px' height='18px' align='absmiddle' src='"+imUrl+"' hspace='2'>"
 }
 hdrHTML+=label;hdrHTML+="</div>";z.cells[col].innerHTML=hdrHTML;if (this._hstyles[col])z.cells[col].style.cssText=this._hstyles[col];}else {z.cells[col].style.textAlign="left";z.cells[col].innerHTML="<img src='"+this.imgURL+""+label+"' onerror='this.src = \""+this.imgURL
 +"imageloaderror.gif\"'>";var a = new Image();a.src=this.imgURL+""+label.replace(/(\.[a-z]+)/, ".des$1");this.preloadImagesAr[this.preloadImagesAr.length]=a;var b = new Image();b.src=this.imgURL+""+label.replace(/(\.[a-z]+)/, ".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=b;}
 if ((label||"").indexOf("#") != -1){var t = label.match(/(^|{)#([^}]+)(}|$)/);if (t){var tn = "_in_header_"+t[2];if (this[tn])this[tn]((this.forceDivInHeader ? z.cells[col].firstChild : z.cells[col]), col, label.split(t[0]));}
 }
 };this.setColLabel = function(a,b,ind,c){return this.setColumnLabel(a,b,(ind||0)+1,c);};this.clearAll=function(header){if (!this.obj.rows[0])return;if (this._h2){this._h2=new dhtmlxHierarchy();if (this._fake){if (this._realfake)this._h2=this._fake._h2;else
 this._fake._h2=this._h2;}
 }
 this.limit=this._limitC=0;this.editStop(true);if (this._dLoadTimer)window.clearTimeout(this._dLoadTimer);if (this._dload){this.objBox.scrollTop=0;this.limit=this._limitC||0;this._initDrF=true;}
 var len = this.rowsCol.length;len=this.obj.rows.length;for (var i = len-1;i > 0;i--){var t_r = this.obj.rows[i];t_r.parentNode.removeChild(t_r);}
 if (header){this._master_row=null;this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);for (var i = this.hdr.rows.length-1;i >= 0;i--){var t_r = this.hdr.rows[i];t_r.parentNode.removeChild(t_r);}
 if (this.ftr){this.ftr.parentNode.removeChild(this.ftr);this.ftr=null;}
 this._aHead=this.ftr=this.cellWidth=this._aFoot=null;this.cellType=dhtmlxArray();this._hrrar=[];this.columnIds=[];this.combos=[];this._strangeParams=[];this.defVal = [];this._ivizcol = null;}
 
 this.row=null;this.cell=null;this.rowsCol=dhtmlxArray()
 this.rowsAr={};this._RaSeCol=[];this.rowsBuffer=dhtmlxArray()
 this.UserData=[]
 this.selectedRows=dhtmlxArray();if (this.pagingOn || this._srnd)this.xmlFileUrl="";if (this.pagingOn)this.changePage(1);if (this._contextCallTimer)window.clearTimeout(this._contextCallTimer);if (this._sst)this.enableStableSorting(true);this._fillers=this.undefined;this.setSortImgState(false);this.setSizes();this.callEvent("onClearAll", []);}
 
 this.sortField=function(ind, repeatFl, r_el){if (this.getRowsNum()== 0)
 return false;var el = this.hdr.rows[0].cells[ind];if (!el)return;if (el.tagName == "TH"&&(this.fldSort.length-1)>= el._cellIndex
 &&this.fldSort[el._cellIndex] != 'na'){var data=this.getSortingState();var sortType= ( data[0]==ind && data[1]=="asc" ) ? "des" : "asc";if (!this.callEvent("onBeforeSorting", [
 ind,
 this.fldSort[ind],
 sortType
 ]))
 return;this.sortImg.src=this.imgURL+"sort_"+(sortType == "asc" ? "asc" : "desc")+".gif";if (this.useImagesInHeader){var cel = this.hdr.rows[1].cells[el._cellIndex].firstChild;if (this.fldSorted != null){var celT = this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild;celT.src=celT.src.replace(/(\.asc\.)|(\.des\.)/, ".");}
 cel.src=cel.src.replace(/(\.[a-z]+)$/, "."+sortType+"$1")
 }
 
 this.sortRows(el._cellIndex, this.fldSort[el._cellIndex], sortType)
 this.fldSorted=el;this.r_fldSorted=r_el;var c = this.hdr.rows[1];var c = r_el.parentNode;var real_el = c._childIndexes ? c._childIndexes[el._cellIndex] : el._cellIndex;this.setSortImgPos(false, false, false, r_el);}
 }
 
 this.enableHeaderImages=function(fl){this.useImagesInHeader=fl;}
 
 this.setHeader=function(hdrStr, splitSign, styles){if (typeof (hdrStr)!= "object")
 var arLab = this._eSplit(hdrStr);else
 arLab=[].concat(hdrStr);var arWdth = new Array(0);var arTyp = new dhtmlxArray(0);var arAlg = new Array(0);var arVAlg = new Array(0);var arSrt = new Array(0);for (var i = 0;i < arLab.length;i++){arWdth[arWdth.length]=Math.round(100 / arLab.length);arTyp[arTyp.length]="ed";arAlg[arAlg.length]="left";arVAlg[arVAlg.length]="middle";arSrt[arSrt.length]="na";}
 this.splitSign=splitSign||"#cspan";this.hdrLabels=arLab;this.cellWidth=arWdth;if (!this.initCellWidth.length)this.setInitWidthsP(arWdth.join(this.delim),true);this.cellType=arTyp;this.cellAlign=arAlg;this.cellVAlign=arVAlg;this.fldSort=arSrt;this._hstyles=styles||[];}
 
 this._eSplit=function(str){if (![].push)return str.split(this.delim);var a = "r"+(new Date()).valueOf();var z = this.delim.replace(/([\|\+\*\^])/g, "\\$1")
 return (str||"").replace(RegExp(z, "g"), a).replace(RegExp("\\\\"+a, "g"), this.delim).split(a);}
 
 this.getColType=function(cInd){return this.cellType[cInd];}
 
 this.getColTypeById=function(cID){return this.cellType[this.getColIndexById(cID)];}
 
 this.setColTypes=function(typeStr){this.cellType=dhtmlxArray(typeStr.split(this.delim));this._strangeParams=new Array();for (var i = 0;i < this.cellType.length;i++){if ((this.cellType[i].indexOf("[")!= -1)){var z = this.cellType[i].split(/[\[\]]+/g);this.cellType[i]=z[0];this.defVal[i]=z[1];if (z[1].indexOf("=")== 0){this.cellType[i]="math";this._strangeParams[i]=z[0];}
 }
 if (!window["eXcell_"+this.cellType[i]])dhtmlxError.throwError("Configuration","Incorrect cell type: "+this.cellType[i],[this,this.cellType[i]]);}
 }
 
 this.setColSorting=function(sortStr){this.fldSort=sortStr.split(this.delim)

 }
 
 this.setColAlign=function(alStr){this.cellAlign=alStr.split(this.delim)
 for (var i=0;i < this.cellAlign.length;i++)this.cellAlign[i]=this.cellAlign[i]._dhx_trim();}
 this.setColVAlign=function(valStr){this.cellVAlign=valStr.split(this.delim)
 }
 this.setNoHeader=function(fl){this.noHeader=convertStringToBoolean(fl);}
 
 this.showRow=function(rowID){this.getRowById(rowID)

 if (this._h2)this.openItem(this._h2.get[rowID].parent.id);var c = this.getRowById(rowID).childNodes[0];while (c&&c.style.display == "none")c=c.nextSibling;if (c)this.moveToVisible(c, true)
 }
 
 this.setStyle=function(ss_header, ss_grid, ss_selCell, ss_selRow){this.ssModifier=[
 ss_header,
 ss_grid,
 ss_selCell,
 ss_selCell,
 ss_selRow
 ];var prefs = ["#"+this.entBox.id+" table.hdr td", "#"+this.entBox.id+" table.obj td",
 "#"+this.entBox.id+" table.obj tr.rowselected td.cellselected",
 "#"+this.entBox.id+" table.obj td.cellselected", "#"+this.entBox.id+" table.obj tr.rowselected td"];var index = 0;while (!_isIE){try{var temp = document.styleSheets[index].cssRules.length;}catch(e) {index++;continue;}
 break;}
 
 for (var i = 0;i < prefs.length;i++)if (this.ssModifier[i]){if (_isIE)document.styleSheets[0].addRule(prefs[i], this.ssModifier[i]);else
 document.styleSheets[index].insertRule(prefs[i]+(" {"+this.ssModifier[i]+" }"), document.styleSheets[index].cssRules.length);}
 }
 
 this.setColumnColor=function(clr){this.columnColor=clr.split(this.delim)
 }
 
 this.enableAlterCss=function(cssE, cssU, perLevel, levelUnique){if (cssE||cssU)this.attachEvent("onGridReconstructed",function(){this._fixAlterCss();if (this._fake)this._fake._fixAlterCss();});this._cssSP=perLevel;this._cssSU=levelUnique;this._cssEven=cssE;this._cssUnEven=cssU;}
 
 this._fixAlterCss=function(ind){if (this._h2 && (this._cssSP || this._cssSU))
 return this._fixAlterCssTGR(ind);if (!this._cssEven && !this._cssUnEven)return;ind=ind||0;var j = ind;for (var i = ind;i < this.rowsCol.length;i++){if (!this.rowsCol[i])continue;if (this.rowsCol[i].style.display != "none"){if (this.rowsCol[i]._cntr){j=1;continue;}
 if (this.rowsCol[i].className.indexOf("rowselected")!= -1){if (j%2 == 1)this.rowsCol[i].className=this._cssUnEven+" rowselected "+(this.rowsCol[i]._css||"");else
 this.rowsCol[i].className=this._cssEven+" rowselected "+(this.rowsCol[i]._css||"");}else {if (j%2 == 1)this.rowsCol[i].className=this._cssUnEven+" "+(this.rowsCol[i]._css||"");else
 this.rowsCol[i].className=this._cssEven+" "+(this.rowsCol[i]._css||"");}
 j++;}
 }
 }
 
 this.getPosition=function(oNode, pNode){if (!pNode && !_isChrome){var pos = getOffset(oNode);return [pos.left, pos.top];}
 pNode = pNode||document.body;var oCurrentNode = oNode;var iLeft = 0;var iTop = 0;while ((oCurrentNode)&&(oCurrentNode != pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent;}
 if (pNode == document.body){if (_isIE){iTop+=document.body.offsetTop||document.documentElement.offsetTop;iLeft+=document.body.offsetLeft||document.documentElement.offsetLeft;}else if (!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop;}
 }
 return [iLeft, iTop];}
 
 this.getFirstParentOfType=function(obj, tag){while (obj&&obj.tagName != tag&&obj.tagName != "BODY"){obj=obj.parentNode;}
 return obj;}
 
 this.objBox.onscroll=function(){this.grid._doOnScroll();};this.hdrBox.onscroll=function(){if (this._try_header_sync)return;this._try_header_sync = true;if (this.grid.objBox.scrollLeft != this.scrollLeft){this.grid.objBox.scrollLeft = this.scrollLeft;}
 this._try_header_sync = false;}
 if ((!_isOpera)||(_OperaRv > 8.5)){this.hdr.onmousemove=function(e){this.grid.changeCursorState(e||window.event);};this.hdr.onmousedown=function(e){return this.grid.startColResize(e||window.event);};}
 this.obj.onmousemove=this._drawTooltip;this.objBox.onclick=function(e){(e||event).cancelBubble=true;};this.obj.onclick=function(e){this.grid._doClick(e||window.event);if (this.grid._sclE)this.grid.editCell(e||window.event);else
 this.grid.editStop();(e||event).cancelBubble=true;};if (_isMacOS){this.entBox.oncontextmenu=function(e){e.cancelBubble=true;e.returnValue=false;return this.grid._doContClick(e||window.event);};}else {this.entBox.onmousedown=function(e){return this.grid._doContClick(e||window.event);};this.entBox.oncontextmenu=function(e){if (this.grid._ctmndx)(e||event).cancelBubble=true;return !this.grid._ctmndx;};}
 

 this.obj.ondblclick=function(e){if (!this.grid.wasDblClicked(e||window.event)) 
 return false;if (this.grid._dclE){var row = this.grid.getFirstParentOfType((_isIE?event.srcElement:e.target),"TR");if (row == this.grid.row)this.grid.editCell(e||window.event);}
 (e||event).cancelBubble=true;if (_isOpera)return false;};this.hdr.onclick=this._onHeaderClick;this.sortImg.onclick=function(){self._onHeaderClick.apply({grid: self
 }, [
 null,
 self.r_fldSorted
 ]);};this.hdr.ondblclick=this._onHeaderDblClick;if (!document.body._dhtmlxgrid_onkeydown){dhtmlxEvent(document, "keydown",function(e){if (globalActiveDHTMLGridObject)return globalActiveDHTMLGridObject.doKey(e||window.event);});document.body._dhtmlxgrid_onkeydown=true;}
 dhtmlxEvent(document.body, "click", function(){if (self.editStop)self.editStop();if (self.isActive)self.setActive(false);});this.entBox.onbeforeactivate=function(){this._still_active=null;this.grid.setActive();event.cancelBubble=true;};this.entBox.onbeforedeactivate=function(){if (this.grid._still_active)this.grid._still_active=null;else 
 this.grid.isActive=false;event.cancelBubble=true;};if (this.entBox.style.height.toString().indexOf("%") != -1)
 this._delta_y = this.entBox.style.height;if (this.entBox.style.width.toString().indexOf("%") != -1)
 this._delta_x = this.entBox.style.width;if (this._delta_x||this._delta_y)this._setAutoResize();this.setColHidden=this.setColumnsVisibility
 this.enableCollSpan = this.enableColSpan
 this.setMultiselect=this.enableMultiselect;this.setMultiLine=this.enableMultiline;this.deleteSelectedItem=this.deleteSelectedRows;this.getSelectedId=this.getSelectedRowId;this.getHeaderCol=this.getColumnLabel;this.isItemExists=this.doesRowExist;this.getColumnCount=this.getColumnsNum;this.setSelectedRow=this.selectRowById;this.setHeaderCol=this.setColumnLabel;this.preventIECashing=this.preventIECaching;this.enableAutoHeigth=this.enableAutoHeight;this.getUID=this.uid;if (dhtmlx.image_path)this.setImagePath(dhtmlx.image_path);if (dhtmlx.skin)this.setSkin(dhtmlx.skin);return this;}
dhtmlXGridObject.prototype={getRowAttribute: function(id, name){return this.getRowById(id)._attrs[name];},
 setRowAttribute: function(id, name, value){this.getRowById(id)._attrs[name]=value;},
 
 isTreeGrid:function(){return (this.cellType._dhx_find("tree") != -1);},
 

 
 setRowHidden:function(id, state){var f = convertStringToBoolean(state);var row = this.getRowById(id) 
 
 if (!row)return;if (row.expand === "")this.collapseKids(row);if ((state)&&(row.style.display != "none")){row.style.display="none";var z = this.selectedRows._dhx_find(row);if (z != -1){row.className=row.className.replace("rowselected", "");for (var i = 0;i < row.childNodes.length;i++)row.childNodes[i].className=row.childNodes[i].className.replace(/cellselected/g, "");this.selectedRows._dhx_removeAt(z);}
 this.callEvent("onGridReconstructed", []);}
 
 if ((!state)&&(row.style.display == "none")){row.style.display="";this.callEvent("onGridReconstructed", []);}
 this.callEvent("onRowHide",[id, state]);this.setSizes();},
 




 
 enableRowsHover:function(mode, cssClass){this._unsetRowHover(false,true);this._hvrCss=cssClass;if (convertStringToBoolean(mode)){if (!this._elmnh){this.obj._honmousemove=this.obj.onmousemove;this.obj.onmousemove=this._setRowHover;if (_isIE)this.obj.onmouseleave=this._unsetRowHover;else
 this.obj.onmouseout=this._unsetRowHover;this._elmnh=true;}
 }else {if (this._elmnh){this.obj.onmousemove=this.obj._honmousemove;if (_isIE)this.obj.onmouseleave=null;else
 this.obj.onmouseout=null;this._elmnh=false;}
 }
 },

 
 enableEditEvents:function(click, dblclick, f2Key){this._sclE=convertStringToBoolean(click);this._dclE=convertStringToBoolean(dblclick);this._f2kE=convertStringToBoolean(f2Key);},
 

 
 enableLightMouseNavigation:function(mode){if (convertStringToBoolean(mode)){if (!this._elmn){this.entBox._onclick=this.entBox.onclick;this.entBox.onclick=function(){return true;};this.obj._onclick=this.obj.onclick;this.obj.onclick=function(e){var c = this.grid.getFirstParentOfType(e ? e.target : event.srcElement, 'TD');if (!c)return;this.grid.editStop();this.grid.doClick(c);this.grid.editCell();(e||event).cancelBubble=true;}
 
 this.obj._onmousemove=this.obj.onmousemove;this.obj.onmousemove=this._autoMoveSelect;this._elmn=true;}
 }else {if (this._elmn){this.entBox.onclick=this.entBox._onclick;this.obj.onclick=this.obj._onclick;this.obj.onmousemove=this.obj._onmousemove;this._elmn=false;}
 }
 },
 
 
 
 _unsetRowHover:function(e, c){if (c)that=this;else
 that=this.grid;if ((that._lahRw)&&(that._lahRw != c)){for (var i = 0;i < that._lahRw.childNodes.length;i++)that._lahRw.childNodes[i].className=that._lahRw.childNodes[i].className.replace(that._hvrCss, "");that._lahRw=null;}
 },
 
 
 _setRowHover:function(e){var c = this.grid.getFirstParentOfType(e ? e.target : event.srcElement, 'TD');if (c && c.parentNode!=this.grid._lahRw){this.grid._unsetRowHover(0, c);c=c.parentNode;if (!c.idd || c.idd=="__filler__")return;for (var i = 0;i < c.childNodes.length;i++)c.childNodes[i].className+=" "+this.grid._hvrCss;this.grid._lahRw=c;}
 this._honmousemove(e);},
 
 
 _autoMoveSelect:function(e){if (!this.grid.editor){var c = this.grid.getFirstParentOfType(e ? e.target : event.srcElement, 'TD');if (c.parentNode.idd)this.grid.doClick(c, true, 0);}
 this._onmousemove(e);},


 
 destructor:function(){this.editStop(true);if (this._sizeTime)this._sizeTime=window.clearTimeout(this._sizeTime);this.entBox.className=(this.entBox.className||"").replace(/gridbox.*/,"");if (this.formInputs)for (var i = 0;i < this.formInputs.length;i++)this.parentForm.removeChild(this.formInputs[i]);var a;this.xmlLoader=this.xmlLoader.destructor();for (var i = 0;i < this.rowsCol.length;i++)if (this.rowsCol[i])this.rowsCol[i].grid=null;for (i in this.rowsAr)if (this.rowsAr[i])this.rowsAr[i]=null;this.rowsCol=new dhtmlxArray();this.rowsAr={};this.entBox.innerHTML="";var dummy=function(){};this.entBox.onclick = this.entBox.onmousedown = this.entBox.onbeforeactivate = this.entBox.onbeforedeactivate = this.entBox.onbeforedeactivate = this.entBox.onselectstart = dummy;this.setSizes = this._update_srnd_view = this.callEvent = dummy;this.entBox.grid=this.objBox.grid=this.hdrBox.grid=this.obj.grid=this.hdr.grid=null;if (this._fake){this.globalBox.innerHTML = "";this._fake.setSizes = this._fake._update_srnd_view = this._fake.callEvent = dummy;this.globalBox.onclick = this.globalBox.onmousedown = this.globalBox.onbeforeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onselectstart = dummy;}
 
 for (a in this){if ((this[a])&&(this[a].m_obj))
 this[a].m_obj=null;this[a]=null;}
 
 if (this == globalActiveDHTMLGridObject)globalActiveDHTMLGridObject=null;return null;},
 

 
 getSortingState:function(){var z = new Array();if (this.fldSorted){z[0]=this.fldSorted._cellIndex;z[1]=(this.sortImg.src.indexOf("sort_desc.gif") != -1) ? "des" : "asc";}
 return z;},

 
 
 enableAutoHeight:function(mode, maxHeight, countFullHeight){this._ahgr=convertStringToBoolean(mode);this._ahgrF=convertStringToBoolean(countFullHeight);this._ahgrM=maxHeight||null;if (arguments.length == 1){this.objBox.style.overflowY=mode?"hidden":"auto";}
 if (maxHeight == "auto"){this._ahgrM=null;this._ahgrMA=true;this._setAutoResize();}
 },

 enableStableSorting:function(mode){this._sst=convertStringToBoolean(mode);this.rowsCol.stablesort=function(cmp){var size = this.length-1;for (var i = 0;i < this.length-1;i++){for (var j = 0;j < size;j++)if (cmp(this[j], this[j+1])> 0){var temp = this[j];this[j]=this[j+1];this[j+1]=temp;}
 size--;}
 }
 },

 
 
 enableKeyboardSupport:function(mode){this._htkebl=!convertStringToBoolean(mode);},
 

 
 enableContextMenu:function(menu){this._ctmndx=menu;},

 
 
 setScrollbarWidthCorrection:function(width){},

 
 enableTooltips:function(list){this._enbTts=list.split(",");for (var i = 0;i < this._enbTts.length;i++)this._enbTts[i]=convertStringToBoolean(this._enbTts[i]);},

 

 
 enableResizing:function(list){this._drsclmn=list.split(",");for (var i = 0;i < this._drsclmn.length;i++)this._drsclmn[i]=convertStringToBoolean(this._drsclmn[i]);},
 
 
 setColumnMinWidth:function(width, ind){if (arguments.length == 2){if (!this._drsclmW)this._drsclmW=new Array();this._drsclmW[ind]=width;}else
 this._drsclmW=width.split(",");},

 
 
 enableCellIds:function(mode){this._enbCid=convertStringToBoolean(mode);},
 
 

 
 lockRow:function(rowId, mode){var z = this.getRowById(rowId);if (z){z._locked=convertStringToBoolean(mode);if ((this.cell)&&(this.cell.parentNode.idd == rowId))
 this.editStop();}
 },

 
 
 _getRowArray:function(row){var text = new Array();for (var ii = 0;ii < row.childNodes.length;ii++){var a = this.cells3(row, ii);text[ii]=a.getValue();}
 
 return text;},

 

 
 
 _launchCommands:function(arr){for (var i = 0;i < arr.length;i++){var args = new Array();for (var j = 0;j < arr[i].childNodes.length;j++)if (arr[i].childNodes[j].nodeType == 1)args[args.length]=arr[i].childNodes[j].firstChild.data;this[arr[i].getAttribute("command")].apply(this, args);}
 },
 
 
 
 _parseHead:function(xmlDoc){var hheadCol = this.xmlLoader.doXPath("./head", xmlDoc);if (hheadCol.length){var headCol = this.xmlLoader.doXPath("./column", hheadCol[0]);var asettings = this.xmlLoader.doXPath("./settings", hheadCol[0]);var awidthmet = "setInitWidths";var split = false;if (asettings[0]){for (var s = 0;s < asettings[0].childNodes.length;s++)switch (asettings[0].childNodes[s].tagName){case "colwidth":
 if (asettings[0].childNodes[s].firstChild&&asettings[0].childNodes[s].firstChild.data == "%")awidthmet="setInitWidthsP";break;case "splitat":
 split=(asettings[0].childNodes[s].firstChild ? asettings[0].childNodes[s].firstChild.data : false);break;}
 }
 this._launchCommands(this.xmlLoader.doXPath("./beforeInit/call", hheadCol[0]));if (headCol.length > 0){if (this.hdr.rows.length > 0)this.clearAll(true);var sets = [
 [],
 [],
 [],
 [],
 [],
 [],
 [],
 [],
 []
 ];var attrs = ["", "width", "type", "align", "sort", "color", "format", "hidden", "id"];var calls = ["", awidthmet, "setColTypes", "setColAlign", "setColSorting", "setColumnColor", "",
 "", "setColumnIds"];for (var i = 0;i < headCol.length;i++){for (var j = 1;j < attrs.length;j++)sets[j].push(headCol[i].getAttribute(attrs[j]));sets[0].push((headCol[i].firstChild
 ? headCol[i].firstChild.data
 : "").replace(/^\s*((\s\S)*.+)\s*$/gi, "$1"));};this.setHeader(sets[0]);for (var i = 0;i < calls.length;i++)if (calls[i])this[calls[i]](sets[i].join(this.delim))
 
 for (var i = 0;i < headCol.length;i++){if ((this.cellType[i].indexOf('co')== 0)||(this.cellType[i] == "clist")){var optCol = this.xmlLoader.doXPath("./option", headCol[i]);if (optCol.length){var resAr = new Array();if (this.cellType[i] == "clist"){for (var j = 0;j < optCol.length;j++)resAr[resAr.length]=optCol[j].firstChild
 ? optCol[j].firstChild.data
 : "";this.registerCList(i, resAr);}else {var combo = this.getCombo(i);for (var j = 0;j < optCol.length;j++)combo.put(optCol[j].getAttribute("value"),
 optCol[j].firstChild
 ? optCol[j].firstChild.data
 : "");}
 }
 }
 
 else if (sets[6][i])if ((this.cellType[i].toLowerCase().indexOf("calendar")!=-1)||(this.fldSort[i] == "date"))
 this.setDateFormat(sets[6][i]);else
 this.setNumberFormat(sets[6][i], i);}
 
 this.init();var param=sets[7].join(this.delim);if (this.setColHidden && param.replace(/,/g,"")!="")
 this.setColHidden(param);if ((split)&&(this.splitAt))
 this.splitAt(split);}
 this._launchCommands(this.xmlLoader.doXPath("./afterInit/call", hheadCol[0]));}
 
 var gudCol = this.xmlLoader.doXPath("//rows/userdata", xmlDoc);if (gudCol.length > 0){if (!this.UserData["gridglobaluserdata"])this.UserData["gridglobaluserdata"]=new Hashtable();for (var j = 0;j < gudCol.length;j++){var u_record = "";for (var xj=0;xj < gudCol[j].childNodes.length;xj++)u_record += gudCol[j].childNodes[xj].nodeValue;this.UserData["gridglobaluserdata"].put(gudCol[j].getAttribute("name"),u_record);}
 }
 },
 
 

 
 
 
 getCheckedRows:function(col_ind){var d = new Array();this.forEachRowA(function(id){if (this.cells(id, col_ind).getValue() != 0)
 d.push(id);},true)
 return d.join(",");},
 
 checkAll:function(){var mode=arguments.length?arguments[0]:1;for (var cInd=0;cInd<this.getColumnsNum();cInd++){if(this.getColType(cInd)=="ch")this.setCheckedRows(cInd,mode)}},
 
 uncheckAll:function(){this.checkAll(0);},
 
 setCheckedRows:function(cInd,v){this.forEachRowA(function(id){if(this.cells(id,cInd).isCheckbox())this.cells(id,cInd).setValue(v)})},

 
 _drawTooltip:function(e){var c = this.grid.getFirstParentOfType(e ? e.target : event.srcElement, 'TD');if (!c || ((this.grid.editor)&&(this.grid.editor.cell == c)))
 return true;var r = c.parentNode;if (!r.idd||r.idd == "__filler__")return;var el = (e ? e.target : event.srcElement);if (r.idd == window.unknown)return true;if (!this.grid.callEvent("onMouseOver", [
 r.idd,
 c._cellIndex,
 (e||window.event)]))
 return true;if ((this.grid._enbTts)&&(!this.grid._enbTts[c._cellIndex])){if (el.title)el.title='';return true;}
 
 if (c._cellIndex >= this.grid._cCount)return;var ced = this.grid.cells3(r, c._cellIndex);if (!ced || !ced.cell || !ced.cell._attrs)return;if (el._title)ced.cell.title="";if (!ced.cell._attrs['title'])el._title=true;if (ced)el.title=ced.cell._attrs['title']
 ||(ced.getTitle
 ? ced.getTitle()
 : (ced.getValue()||"").toString().replace(/<[^>]*>/gi, ""));return true;},

 
 enableCellWidthCorrection:function(size){if (_isFF)this._wcorr=parseInt(size);},
 
 
 
 getAllRowIds:function(separator){var ar = [];for (var i = 0;i < this.rowsBuffer.length;i++)if (this.rowsBuffer[i])ar.push(this.rowsBuffer[i].idd);return ar.join(separator||this.delim)
 },
 getAllItemIds:function(){return this.getAllRowIds();},
 

 
 
 preventIECaching:function(mode){this.no_cashe=convertStringToBoolean(mode);this.xmlLoader.rSeed=this.no_cashe;},
 enableColumnAutoSize:function(mode){this._eCAS=convertStringToBoolean(mode);},
 
 _onHeaderDblClick:function(e){var that = this.grid;var el = that.getFirstParentOfType(_isIE ? event.srcElement : e.target, "TD");if (!that._eCAS)return false;that.adjustColumnSize(el._cellIndexS)
 },
 
 
 adjustColumnSize:function(cInd, complex){if (this._hrrar && this._hrrar[cInd])return;this._notresize=true;var m = 0;this._setColumnSizeR(cInd, 20);for (var j = 1;j < this.hdr.rows.length;j++){var a = this.hdr.rows[j];a=a.childNodes[(a._childIndexes) ? a._childIndexes[cInd] : cInd];if ((a)&&((!a.colSpan)||(a.colSpan < 2)) && a._cellIndex==cInd){if ((a.childNodes[0])&&(a.childNodes[0].className == "hdrcell"))
 a=a.childNodes[0];m=Math.max(m, ((_isFF||_isOpera) ? (a.textContent.length*this.fontWidth) : a.scrollWidth));}
 }
 
 var l = this.obj.rows.length;for (var i = 1;i < l;i++){var z = this.obj.rows[i];if (!this.rowsAr[z.idd])continue;if (z._childIndexes&&z._childIndexes[cInd] != cInd || !z.childNodes[cInd])continue;if (_isFF||_isOpera||complex)z=z.childNodes[cInd].textContent.length*this.fontWidth;else
 z=z.childNodes[cInd].scrollWidth;if (z > m)m=z;}
 m+=20+(complex||0);this._setColumnSizeR(cInd, m);this._notresize=false;this.setSizes();},
 

 
 detachHeader:function(index, hdr){hdr=hdr||this.hdr;var row = hdr.rows[index+1];if (row)row.parentNode.removeChild(row);this.setSizes();},
 
 
 detachFooter:function(index){this.detachHeader(index, this.ftr);},
 
 
 attachHeader:function(values, style, _type){if (typeof (values)== "string")
 values=this._eSplit(values);if (typeof (style)== "string")
 style=style.split(this.delim);_type=_type||"_aHead";if (this.hdr.rows.length){if (values)this._createHRow([
 values,
 style
 ], this[(_type == "_aHead") ? "hdr" : "ftr"]);else if (this[_type])for (var i = 0;i < this[_type].length;i++)this.attachHeader.apply(this, this[_type][i]);}else {if (!this[_type])this[_type]=new Array();this[_type][this[_type].length]=[
 values,
 style,
 _type
 ];}
 },
 
 _createHRow:function(data, parent){if (!parent){if (this.entBox.style.position!="absolute")this.entBox.style.position="relative";var z = document.createElement("DIV");z.className="c_ftr".substr(2);this.entBox.appendChild(z);var t = document.createElement("TABLE");t.cellPadding=t.cellSpacing=0;if (!_isIE || _isIE == 8){t.width="100%";t.style.paddingRight="20px";}
 t.style.marginRight="20px";t.style.tableLayout="fixed";z.appendChild(t);t.appendChild(document.createElement("TBODY"));this.ftr=parent=t;var hdrRow = t.insertRow(0);var thl = ((this.hdrLabels.length <= 1) ? data[0].length : this.hdrLabels.length);for (var i = 0;i < thl;i++){hdrRow.appendChild(document.createElement("TH"));hdrRow.childNodes[i]._cellIndex=i;}
 
 if (_isIE && _isIE<8)hdrRow.style.position="absolute";else
 hdrRow.style.height='auto';}
 var st1 = data[1];var z = document.createElement("TR");parent.rows[0].parentNode.appendChild(z);for (var i = 0;i < data[0].length;i++){if (data[0][i] == "#cspan"){var pz = z.cells[z.cells.length-1];pz.colSpan=(pz.colSpan||1)+1;continue;}
 
 if ((data[0][i] == "#rspan")&&(parent.rows.length > 1)){var pind = parent.rows.length-2;var found = false;var pz = null;while (!found){var pz = parent.rows[pind];for (var j = 0;j < pz.cells.length;j++)if (pz.cells[j]._cellIndex == i){found=j+1;break;}
 pind--;}
 
 pz=pz.cells[found-1];pz.rowSpan=(pz.rowSpan||1)+1;continue;}
 
 var w = document.createElement("TD");w._cellIndex=w._cellIndexS=i;if (this._hrrar && this._hrrar[i] && !_isIE)w.style.display='none';if (typeof data[0][i] == "object")w.appendChild(data[0][i]);else {if (this.forceDivInHeader)w.innerHTML="<div class='hdrcell'>"+(data[0][i]||"&nbsp;")+"</div>";else
 w.innerHTML=(data[0][i]||"&nbsp;");if ((data[0][i]||"").indexOf("#") != -1){var t = data[0][i].match(/(^|{)#([^}]+)(}|$)/);if (t){var tn = "_in_header_"+t[2];if (this[tn])this[tn]((this.forceDivInHeader ? w.firstChild : w), i, data[0][i].split(t[0]));}
 }
 }
 if (st1)w.style.cssText=st1[i];z.appendChild(w);}
 var self = parent;if (_isKHTML){if (parent._kTimer)window.clearTimeout(parent._kTimer);parent._kTimer=window.setTimeout(function(){parent.rows[1].style.display='none';window.setTimeout(function(){parent.rows[1].style.display='';}, 1);}, 500);}
 },




 
 forEachRow:function(custom_code){for (var a in this.rowsAr)if (this.rowsAr[a]&&this.rowsAr[a].idd)custom_code.apply(this, [this.rowsAr[a].idd]);},
 forEachRowA:function(custom_code){for (var a =0;a<this.rowsBuffer.length;a++){if (this.rowsBuffer[a])custom_code.call(this, this.render_row(a).idd);}
 },
 
 forEachCell:function(rowId, custom_code){var z = this.getRowById(rowId);if (!z)return;for (var i = 0;i < this._cCount;i++)custom_code(this.cells3(z, i),i);},
 
 enableAutoWidth:function(mode, max_limit, min_limit){this._awdth=[
 convertStringToBoolean(mode),
 parseInt(max_limit||99999),
 parseInt(min_limit||0)
 ];if (arguments.length == 1)this.objBox.style.overflowX=mode?"hidden":"auto";},

 
 
 updateFromXML:function(url, insert_new, del_missed, afterCall){if (typeof insert_new == "undefined")insert_new=true;this._refresh_mode=[
 true,
 insert_new,
 del_missed
 ];this.load(url,afterCall)
 },
 _refreshFromXML:function(xml){if (this._f_rowsBuffer)this.filterBy(0,"");reset = false;if (window.eXcell_tree){eXcell_tree.prototype.setValueX=eXcell_tree.prototype.setValue;eXcell_tree.prototype.setValue=function(content){var r=this.grid._h2.get[this.cell.parentNode.idd]
 if (r && this.cell.parentNode.valTag){this.setLabel(content);}else
 this.setValueX(content);};}
 
 var tree = this.cellType._dhx_find("tree");xml.getXMLTopNode("rows");var pid = xml.doXPath("//rows")[0].getAttribute("parent")||0;var del = {};if (this._refresh_mode[2]){if (tree != -1)this._h2.forEachChild(pid, function(obj){del[obj.id]=true;}, this);else
 this.forEachRow(function(id){del[id]=true;});}
 
 var rows = xml.doXPath("//row");for (var i = 0;i < rows.length;i++){var row = rows[i];var id = row.getAttribute("id");del[id]=false;var pid = row.parentNode.getAttribute("id")||pid;if (this.rowsAr[id] && this.rowsAr[id].tagName!="TR"){if (this._h2)this._h2.get[id].buff.data=row;else
 this.rowsBuffer[this.getRowIndex(id)].data=row;this.rowsAr[id]=row;}else if (this.rowsAr[id]){this._process_xml_row(this.rowsAr[id], row, -1);this._postRowProcessing(this.rowsAr[id],true)
 }else if (this._refresh_mode[1]){var dadd={idd: id,
 data: row,
 _parser: this._process_xml_row,
 _locator: this._get_xml_data
 };var render_index = this.rowsBuffer.length;if (this._refresh_mode[1]=="top"){this.rowsBuffer.unshift(dadd);render_index = 0;}else
 this.rowsBuffer.push(dadd);if (this._h2){reset=true;(this._h2.add(id,(row.parentNode.getAttribute("id")||row.parentNode.getAttribute("parent")))).buff=this.rowsBuffer[this.rowsBuffer.length-1];}
 
 this.rowsAr[id]=row;row=this.render_row(render_index);this._insertRowAt(row,render_index?-1:0)
 }
 }
 
 if (this._refresh_mode[2])for (id in del){if (del[id]&&this.rowsAr[id])this.deleteRow(id);}
 
 this._refresh_mode=null;if (window.eXcell_tree)eXcell_tree.prototype.setValue=eXcell_tree.prototype.setValueX;if (reset)this._renderSort();if (this._f_rowsBuffer){this._f_rowsBuffer = null;this.filterByAll();}
 },


 
 getCustomCombo:function(id, ind){var cell = this.cells(id, ind).cell;if (!cell._combo)cell._combo=new dhtmlXGridComboObject();return cell._combo;},

 
 setTabOrder:function(order){var t = order.split(this.delim);this._tabOrder=[];var max=this._cCount||order.length;for (var i = 0;i < max;i++)t[i]={c: parseInt(t[i]),
 ind: i
 };t.sort(function(a, b){return (a.c > b.c ? 1 : -1);});for (var i = 0;i < max;i++)if (!t[i+1]||( typeof t[i].c == "undefined"))
 this._tabOrder[t[i].ind]=(t[0].ind+1)*-1;else
 this._tabOrder[t[i].ind]=t[i+1].ind;},
 
 i18n:{loading: "Loading",
 decimal_separator:".",
 group_separator:","
 },
 
 
 _key_events:{k13_1_0: function(){var rowInd = this.rowsCol._dhx_find(this.row)
 this.selectCell(this.rowsCol[rowInd+1], this.cell._cellIndex, true);},
 k13_0_1: function(){var rowInd = this.rowsCol._dhx_find(this.row)
 this.selectCell(this.rowsCol[rowInd-1], this.cell._cellIndex, true);},
 k13_0_0: function(){this.editStop();this.callEvent("onEnter", [
 (this.row ? this.row.idd : null),
 (this.cell ? this.cell._cellIndex : null)
 ]);this._still_active=true;},
 k9_0_0: function(){this.editStop();if (!this.callEvent("onTab",[true])) return true;var z = this._getNextCell(null, 1);if (z){this.selectCell(z.parentNode, z._cellIndex, (this.row != z.parentNode), false, true);this._still_active=true;}
 },
 k9_0_1: function(){this.editStop();if (!this.callEvent("onTab",[false])) return false;var z = this._getNextCell(null, -1);if (z){this.selectCell(z.parentNode, z._cellIndex, (this.row != z.parentNode), false, true);this._still_active=true;}
 },
 k113_0_0: function(){if (this._f2kE)this.editCell();},
 k32_0_0: function(){var c = this.cells4(this.cell);if (!c.changeState||(c.changeState()=== false))
 return false;},
 k27_0_0: function(){this.editStop(true);},
 k33_0_0: function(){if (this.pagingOn)this.changePage(this.currentPage-1);else
 this.scrollPage(-1);},
 k34_0_0: function(){if (this.pagingOn)this.changePage(this.currentPage+1);else
 this.scrollPage(1);},
 k37_0_0: function(){if (!this.editor&&this.isTreeGrid())
 this.collapseKids(this.row)
 else
 return false;},
 k39_0_0: function(){if (!this.editor&&this.isTreeGrid())
 this.expandKids(this.row)
 else
 return false;},
 k40_0_0: function(){var master = this._realfake?this._fake:this;if (this.editor&&this.editor.combo)this.editor.shiftNext();else {if (!this.row.idd)return;var rowInd = Math.max((master._r_select||0),this.getRowIndex(this.row.idd))+1;if (this.rowsBuffer[rowInd]){master._r_select=null;this.selectCell(rowInd, this.cell._cellIndex, true);if (master.pagingOn)master.showRow(master.getRowId(rowInd));}else {if (!this.callEvent("onLastRow", [])) return false;this._key_events.k34_0_0.apply(this, []);if (this.pagingOn && this.rowsCol[rowInd])this.selectCell(rowInd, 0, true);}
 }
 this._still_active=true;},
 k38_0_0: function(){var master = this._realfake?this._fake:this;if (this.editor&&this.editor.combo)this.editor.shiftPrev();else {if (!this.row.idd)return;var rowInd = this.getRowIndex(this.row.idd)+1;if (rowInd != -1 && (!this.pagingOn || (rowInd!=1))){var nrow = this._nextRow(rowInd-1, -1);this.selectCell(nrow, this.cell._cellIndex, true);if (master.pagingOn && nrow)master.showRow(nrow.idd);}else {this._key_events.k33_0_0.apply(this, []);}
 }
 this._still_active=true;}
 },
 
 
 
 _build_master_row:function(){var t = document.createElement("DIV");var html = ["<table><tr>"];for (var i = 0;i < this._cCount;i++)html.push("<td></td>");html.push("</tr></table>");t.innerHTML=html.join("");this._master_row=t.firstChild.rows[0];},
 
 _prepareRow:function(new_id){if (!this._master_row)this._build_master_row();var r = this._master_row.cloneNode(true);for (var i = 0;i < r.childNodes.length;i++){r.childNodes[i]._cellIndex=i;if (this._enbCid)r.childNodes[i].id="c_"+new_id+"_"+i;if (this.dragAndDropOff)this.dragger.addDraggableItem(r.childNodes[i], this);}
 r.idd=new_id;r.grid=this;return r;},
 

 _process_jsarray_row:function(r, data){r._attrs={};for (var j = 0;j < r.childNodes.length;j++)r.childNodes[j]._attrs={};this._fillRow(r, (this._c_order ? this._swapColumns(data) : data));return r;},
 _get_jsarray_data:function(data, ind){return data[ind];},
 _process_json_row:function(r, data){data = this._c_order ? this._swapColumns(data.data) : data.data;return this._process_some_row(r, data);},
 _process_some_row:function(r,data){r._attrs={};for (var j = 0;j < r.childNodes.length;j++)r.childNodes[j]._attrs={};this._fillRow(r, data);return r;},
 _get_json_data:function(data, ind){return data.data[ind];},


 _process_js_row:function(r, data){var arr = [];for (var i=0;i<this.columnIds.length;i++){arr[i] = data[this.columnIds[i]];if (!arr[i] && arr[i]!==0)arr[i]="";}
 this._process_some_row(r,arr);r._attrs = data;return r;},
 _get_js_data:function(data, ind){return data[this.columnIds[ind]];},
 _process_csv_row:function(r, data){r._attrs={};for (var j = 0;j < r.childNodes.length;j++)r.childNodes[j]._attrs={};this._fillRow(r, (this._c_order ? this._swapColumns(data.split(this.csv.cell)) : data.split(this.csv.cell)));return r;},
 _get_csv_data:function(data, ind){return data.split(this.csv.cell)[ind];},

 _process_store_row:function(row, data){var result = [];for (var i = 0;i < this.columnIds.length;i++)result[i] = data[this.columnIds[i]];for (var j = 0;j < row.childNodes.length;j++)row.childNodes[j]._attrs={};row._attrs = data;this._fillRow(row, result);}, 

 _process_xml_row:function(r, xml){var cellsCol = this.xmlLoader.doXPath(this.xml.cell, xml);var strAr = [];r._attrs=this._xml_attrs(xml);if (this._ud_enabled){var udCol = this.xmlLoader.doXPath("./userdata", xml);for (var i = udCol.length-1;i >= 0;i--){var u_record = "";for (var j=0;j < udCol[i].childNodes.length;j++)u_record += udCol[i].childNodes[j].nodeValue;this.setUserData(r.idd,udCol[i].getAttribute("name"), u_record);}
 }
 
 
 for (var j = 0;j < cellsCol.length;j++){var cellVal = cellsCol[this._c_order?this._c_order[j]:j];if (!cellVal)continue;var cind = r._childIndexes?r._childIndexes[j]:j;var exc = cellVal.getAttribute("type");if (r.childNodes[cind]){if (exc)r.childNodes[cind]._cellType=exc;r.childNodes[cind]._attrs=this._xml_attrs(cellVal);}
 
 if (!cellVal.getAttribute("xmlcontent")){if (cellVal.firstChild)cellVal=cellVal.firstChild.data;else
 cellVal="";}
 
 strAr.push(cellVal);}
 
 for (j < cellsCol.length;j < r.childNodes.length;j++)r.childNodes[j]._attrs={};if (r.parentNode&&r.parentNode.tagName == "row")r._attrs["parent"]=r.parentNode.getAttribute("idd");this._fillRow(r, strAr);return r;},
 _get_xml_data:function(data, ind){data=data.firstChild;while (true){if (!data)return "";if (data.tagName == "cell")ind--;if (ind < 0)break;data=data.nextSibling;}
 return (data.firstChild ? data.firstChild.data : "");},

 _fillRow:function(r, text){if (this.editor)this.editStop();for (var i = 0;i < r.childNodes.length;i++){if ((i < text.length)||(this.defVal[i])){var ii=r.childNodes[i]._cellIndex;var val = text[ii];var aeditor = this.cells4(r.childNodes[i]);if ((this.defVal[ii])&&((val == "")||( typeof (val) == "undefined")))
 val=this.defVal[ii];if (aeditor)aeditor.setValue(val)
 }else {r.childNodes[i].innerHTML="&nbsp;";r.childNodes[i]._clearCell=true;}
 }
 
 return r;},
 
 _postRowProcessing:function(r,donly){if (r._attrs["class"])r._css=r.className=r._attrs["class"];if (r._attrs.locked)r._locked=true;if (r._attrs.bgColor)r.bgColor=r._attrs.bgColor;var cor=0;for (var i = 0;i < r.childNodes.length;i++){var c=r.childNodes[i];var ii=c._cellIndex;var s = c._attrs.style||r._attrs.style;if (s)c.style.cssText+=";"+s;if (c._attrs["class"])c.className=c._attrs["class"];s=c._attrs.align||this.cellAlign[ii];if (s)c.align=s;c.vAlign=c._attrs.valign||this.cellVAlign[ii];var color = c._attrs.bgColor||this.columnColor[ii];if (color)c.bgColor=color;if (c._attrs["colspan"] && !donly){this.setColspan(r.idd, i+cor, c._attrs["colspan"]);cor+=(c._attrs["colspan"]-1);}
 
 if (this._hrrar&&this._hrrar[ii]&&!donly){c.style.display="none";}
 };this.callEvent("onRowCreated", [
 r.idd,
 r,
 null
 ]);},
 
 load:function(url, call, type){this.callEvent("onXLS", [this]);if (arguments.length == 2 && typeof call != "function"){type=call;call=null;}
 type=type||"xml";if (!this.xmlFileUrl)this.xmlFileUrl=url;this._data_type=type;this.xmlLoader.onloadAction=function(that, b, c, d, xml){if (!that.callEvent)return;xml=that["_process_"+type](xml);if (!that._contextCallTimer)that.callEvent("onXLE", [that,0,0,xml]);if (call){call();call=null;}
 }
 this.xmlLoader.loadXML(url);},

 loadXML:function(url, afterCall){this.load(url, afterCall, "xml")
 },
 
 parse:function(data, call, type){if (arguments.length == 2 && typeof call != "function"){type=call;call=null;}
 type=type||"xml";this._data_type=type;data=this["_process_"+type](data);if (!this._contextCallTimer)this.callEvent("onXLE", [this,0,0,data]);if (call)call();},
 
 xml:{top: "rows",
 row: "./row",
 cell: "./cell",
 s_row: "row",
 s_cell: "cell",
 row_attrs: [],
 cell_attrs: []
 },
 
 csv:{row: "\n",
 cell: ","
 },
 
 _xml_attrs:function(node){var data = {};if (node.attributes.length){for (var i = 0;i < node.attributes.length;i++)data[node.attributes[i].name]=node.attributes[i].value;}
 
 return data;},

 _process_xml:function(xml){if (!xml.doXPath){var t = new dtmlXMLLoaderObject(function(){});if (typeof xml == "string")t.loadXMLString(xml);else {if (xml.responseXML)t.xmlDoc=xml;else
 t.xmlDoc={};t.xmlDoc.responseXML=xml;}
 xml=t;}
 if (this._refresh_mode)return this._refreshFromXML(xml);this._parsing=true;var top = xml.getXMLTopNode(this.xml.top)
 if (top.tagName!=this.xml.top)return;var skey = top.getAttribute("dhx_security");if (skey)dhtmlx.security_key = skey;this._parseHead(top);var rows = xml.doXPath(this.xml.row, top)
 var cr = parseInt(xml.doXPath("//"+this.xml.top)[0].getAttribute("pos")||0);var total = parseInt(xml.doXPath("//"+this.xml.top)[0].getAttribute("total_count")||0);var reset = false;if (total && total!=this.rowsBuffer.length){if (!this.rowsBuffer[total-1]){if (this.rowsBuffer.length)reset=true;this.rowsBuffer[total-1]=null;}
 if (total<this.rowsBuffer.length){this.rowsBuffer.splice(total, this.rowsBuffer.length - total);reset = true;}
 }
 
 
 if (this.isTreeGrid())
 return this._process_tree_xml(xml);for (var i = 0;i < rows.length;i++){if (this.rowsBuffer[i+cr])continue;var id = rows[i].getAttribute("id")||(i+cr+1);this.rowsBuffer[i+cr]={idd: id,
 data: rows[i],
 _parser: this._process_xml_row,
 _locator: this._get_xml_data
 };this.rowsAr[id]=rows[i];}
 if (reset && this._srnd){var h = this.objBox.scrollTop;this._reset_view();this.objBox.scrollTop = h;}else {this.render_dataset();}
 
 this._parsing=false;return xml.xmlDoc.responseXML?xml.xmlDoc.responseXML:xml.xmlDoc;},


 _process_jsarray:function(data){this._parsing=true;if (data&&data.xmlDoc){eval("dhtmlx.temp="+data.xmlDoc.responseText+";");data = dhtmlx.temp;}
 
 for (var i = 0;i < data.length;i++){var id = i+1;this.rowsBuffer.push({idd: id,
 data: data[i],
 _parser: this._process_jsarray_row,
 _locator: this._get_jsarray_data
 });this.rowsAr[id]=data[i];}
 this.render_dataset();this._parsing=false;},
 
 _process_csv:function(data){this._parsing=true;if (data.xmlDoc)data=data.xmlDoc.responseText;data=data.replace(/\r/g,"");data=data.split(this.csv.row);if (this._csvHdr){this.clearAll();var thead=data.splice(0,1)[0].split(this.csv.cell);if (!this._csvAID)thead.splice(0,1);this.setHeader(thead.join(this.delim));this.init();}
 
 for (var i = 0;i < data.length;i++){if (!data[i] && i==data.length-1)continue;if (this._csvAID){var id = i+1;this.rowsBuffer.push({idd: id,
 data: data[i],
 _parser: this._process_csv_row,
 _locator: this._get_csv_data
 });}else {var temp = data[i].split(this.csv.cell);var id = temp.splice(0,1)[0];this.rowsBuffer.push({idd: id,
 data: temp,
 _parser: this._process_jsarray_row,
 _locator: this._get_jsarray_data
 });}
 
 
 this.rowsAr[id]=data[i];}
 this.render_dataset();this._parsing=false;},
 
 _process_js:function(data){return this._process_json(data, "js");},

 _process_json:function(data, mode){this._parsing=true;if (data&&data.xmlDoc){eval("dhtmlx.temp="+data.xmlDoc.responseText+";");data = dhtmlx.temp;}
 
 if (mode == "js"){if (data.data)data = data.data;for (var i = 0;i < data.length;i++){var row = data[i];var id = row.id||(i+1);this.rowsBuffer.push({idd: id,
 data: row,
 _parser: this._process_js_row,
 _locator: this._get_js_data
 });this.rowsAr[id]=data[i];}
 }else {for (var i = 0;i < data.rows.length;i++){var id = data.rows[i].id;this.rowsBuffer.push({idd: id,
 data: data.rows[i],
 _parser: this._process_json_row,
 _locator: this._get_json_data
 });this.rowsAr[id]=data[i];}
 }
 if (data.dhx_security)dhtmlx.security_key = data.dhx_security;this.render_dataset();this._parsing=false;},

 render_dataset:function(min, max){if (this._srnd){if (this._fillers)return this._update_srnd_view();max=Math.min((this._get_view_size()+(this._srnd_pr||0)), this.rowsBuffer.length);}
 
 if (this.pagingOn){min=Math.max((min||0),(this.currentPage-1)*this.rowsBufferOutSize);max=Math.min(this.currentPage*this.rowsBufferOutSize, this.rowsBuffer.length)
 }else {min=min||0;max=max||this.rowsBuffer.length;}
 
 for (var i = min;i < max;i++){var r = this.render_row(i)
 
 if (r == -1){if (this.xmlFileUrl){if (this.callEvent("onDynXLS",[i,(this._dpref?this._dpref:(max-i))]))
 this.load(this.xmlFileUrl+getUrlSymbol(this.xmlFileUrl)+"posStart="+i+"&count="+(this._dpref?this._dpref:(max-i)), this._data_type);}
 max=i;break;}
 
 if (!r.parentNode||!r.parentNode.tagName){this._insertRowAt(r, i);if (r._attrs["selected"] || r._attrs["select"]){this.selectRow(r,r._attrs["call"]?true:false,true);r._attrs["selected"]=r._attrs["select"]=null;}
 }
 
 
 if (this._ads_count && i-min==this._ads_count){var that=this;this._context_parsing=this._context_parsing||this._parsing;return this._contextCallTimer=window.setTimeout(function(){that._contextCallTimer=null;that.render_dataset(i,max);if (!that._contextCallTimer){if(that._context_parsing)that.callEvent("onXLE",[])
 else 
 that._fixAlterCss();that.callEvent("onDistributedEnd",[]);that._context_parsing=false;}
 },this._ads_time)
 }
 }
 
 if (this._srnd&&!this._fillers){var add_count = this.rowsBuffer.length-max;this._fillers = [];while (add_count > 0){var add_step = _isIE?Math.min(add_count, 50000):add_count;var new_filler = this._add_filler(max, add_step);if (new_filler)this._fillers.push(new_filler);add_count -= add_step;max += add_step;}
 }
 
 
 this.setSizes();},
 
 render_row:function(ind){if (!this.rowsBuffer[ind])return -1;if (this.rowsBuffer[ind]._parser){var r = this.rowsBuffer[ind];if (this.rowsAr[r.idd] && this.rowsAr[r.idd].tagName=="TR")return this.rowsBuffer[ind]=this.rowsAr[r.idd];var row = this._prepareRow(r.idd);this.rowsBuffer[ind]=row;this.rowsAr[r.idd]=row;r._parser.call(this, row, r.data);this._postRowProcessing(row);return row;}
 return this.rowsBuffer[ind];},
 
 
 _get_cell_value:function(row, ind, method){if (row._locator){if (this._c_order)ind=this._c_order[ind];return row._locator.call(this, row.data, ind);}
 return this.cells3(row, ind)[method ? method : "getValue"]();},

 
 sortRows:function(col, type, order){order=(order||"asc").toLowerCase();type=(type||this.fldSort[col]);col=col||0;if (this.isTreeGrid())
 this.sortTreeRows(col, type, order);else{var arrTS = {};var atype = this.cellType[col];var amet = "getValue";if (atype == "link")amet="getContent";if (atype == "dhxCalendar"||atype == "dhxCalendarA")amet="getDate";for (var i = 0;i < this.rowsBuffer.length;i++)arrTS[this.rowsBuffer[i].idd]=this._get_cell_value(this.rowsBuffer[i], col, amet);this._sortRows(col, type, order, arrTS);}
 this.callEvent("onAfterSorting", [col,type,order]);},
 
 _sortCore:function(col, type, order, arrTS, s){var sort = "sort";if (this._sst){s["stablesort"]=this.rowsCol.stablesort;sort="stablesort";}
 if (type == 'str'){s[sort](function(a, b){if (order == "asc")return arrTS[a.idd] > arrTS[b.idd] ? 1 : -1
 else
 return arrTS[a.idd] < arrTS[b.idd] ? 1 : -1
 });}
 else if (type == 'int'){s[sort](function(a, b){var aVal = parseFloat(arrTS[a.idd]);aVal=isNaN(aVal) ? -99999999999999 : aVal;var bVal = parseFloat(arrTS[b.idd]);bVal=isNaN(bVal) ? -99999999999999 : bVal;if (order == "asc")return aVal-bVal;else
 return bVal-aVal;});}
 else if (type == 'date'){s[sort](function(a, b){var aVal = Date.parse(arrTS[a.idd])||(Date.parse("01/01/1900"));var bVal = Date.parse(arrTS[b.idd])||(Date.parse("01/01/1900"));if (order == "asc")return aVal-bVal
 else
 return bVal-aVal
 });}
 },
 
 _sortRows:function(col, type, order, arrTS){this._sortCore(col, type, order, arrTS, this.rowsBuffer);this._reset_view();this.callEvent("onGridReconstructed", []);},

 _reset_view:function(skip){if (!this.obj.rows[0])return;this.callEvent("onResetView",[]);var tb = this.obj.rows[0].parentNode;var tr = tb.removeChild(tb.childNodes[0], true)
 if (_isKHTML)for (var i = tb.parentNode.childNodes.length-1;i >= 0;i--){if (tb.parentNode.childNodes[i].tagName=="TR")tb.parentNode.removeChild(tb.parentNode.childNodes[i],true);}
 else if (_isIE)for (var i = tb.childNodes.length-1;i >= 0;i--)tb.childNodes[i].removeNode(true);else
 tb.innerHTML="";tb.appendChild(tr)
 this.rowsCol=dhtmlxArray();if (this._sst)this.enableStableSorting(true);this._fillers=this.undefined;if (!skip){if (_isIE && this._srnd){this.render_dataset();}
 else
 this.render_dataset();}
 
 
 },
 
 
 deleteRow:function(row_id, node){if (!node)node=this.getRowById(row_id)
 
 if (!node)return;this.editStop();if (!this._realfake)if (this.callEvent("onBeforeRowDeleted", [row_id])== false)
 return false;var pid=0;if (this.cellType._dhx_find("tree")!= -1 && !this._realfake){pid=this._h2.get[row_id].parent.id;this._removeTrGrRow(node);}
 else {if (node.parentNode)node.parentNode.removeChild(node);var ind = this.rowsCol._dhx_find(node);if (ind != -1)this.rowsCol._dhx_removeAt(ind);for (var i = 0;i < this.rowsBuffer.length;i++)if (this.rowsBuffer[i]&&this.rowsBuffer[i].idd == row_id){this.rowsBuffer._dhx_removeAt(i);ind=i;break;}
 }
 this.rowsAr[row_id]=null;for (var i = 0;i < this.selectedRows.length;i++)if (this.selectedRows[i].idd == row_id)this.selectedRows._dhx_removeAt(i);if (this._srnd){for (var i = 0;i < this._fillers.length;i++){var f = this._fillers[i]
 if (!f)continue;if (f[0] >= ind)f[0]=f[0]-1;else if (f[1] >= ind)f[1]=f[1]-1;};this._update_srnd_view();}
 
 if (this.pagingOn)this.changePage();if (!this._realfake)this.callEvent("onAfterRowDeleted", [row_id,pid]);this.callEvent("onGridReconstructed", []);if (this._ahgr)this.setSizes();return true;},
 
 _addRow:function(new_id, text, ind){if (ind == -1|| typeof ind == "undefined")ind=this.rowsBuffer.length;if (typeof text == "string")text=text.split(this.delim);var row = this._prepareRow(new_id);row._attrs={};for (var j = 0;j < row.childNodes.length;j++)row.childNodes[j]._attrs={};this.rowsAr[row.idd]=row;if (this._h2)this._h2.get[row.idd].buff=row;this._fillRow(row, text);this._postRowProcessing(row);if (this._skipInsert){this._skipInsert=false;return this.rowsAr[row.idd]=row;}
 
 if (this.pagingOn){this.rowsBuffer._dhx_insertAt(ind,row);this.rowsAr[row.idd]=row;return row;}
 
 if (this._fillers){this.rowsCol._dhx_insertAt(ind, null);this.rowsBuffer._dhx_insertAt(ind,row);if (this._fake)this._fake.rowsCol._dhx_insertAt(ind, null);this.rowsAr[row.idd]=row;var found = false;for (var i = 0;i < this._fillers.length;i++){var f = this._fillers[i];if (f&&f[0] <= ind&&(f[0]+f[1])>= ind){f[1]=f[1]+1;f[2].firstChild.style.height=parseInt(f[2].firstChild.style.height)+this._srdh+"px";found=true;if (this._fake)this._fake._fillers[i][1]++;}
 
 if (f&&f[0] > ind){f[0]=f[0]+1
 if (this._fake)this._fake._fillers[i][0]++;}
 }
 
 if (!found)this._fillers.push(this._add_filler(ind, 1, (ind == 0 ? {parentNode: this.obj.rows[0].parentNode,
 nextSibling: (this.rowsCol[1])
 }: this.rowsCol[ind-1])));return row;}
 this.rowsBuffer._dhx_insertAt(ind,row);return this._insertRowAt(row, ind);},
 
 
 addRow:function(new_id, text, ind){var r = this._addRow(new_id, text, ind);if (!this.dragContext)this.callEvent("onRowAdded", [new_id]);if (this.pagingOn)this.changePage(this.currentPage)
 
 if (this._srnd)this._update_srnd_view();r._added=true;if (this._ahgr)this.setSizes();this.callEvent("onGridReconstructed", []);return r;},
 
 _insertRowAt:function(r, ind, skip){this.rowsAr[r.idd]=r;if (this._skipInsert){this._skipInsert=false;return r;}
 
 if ((ind < 0)||((!ind)&&(parseInt(ind) !== 0)))
 ind=this.rowsCol.length;else {if (ind > this.rowsCol.length)ind=this.rowsCol.length;}
 
 if (this._cssEven){if ((this._cssSP ? this.getLevel(r.idd): ind)%2 == 1)
 r.className+=" "+this._cssUnEven+(this._cssSU ? (" "+this._cssUnEven+"_"+this.getLevel(r.idd)) : "");else
 r.className+=" "+this._cssEven+(this._cssSU ? (" "+this._cssEven+"_"+this.getLevel(r.idd)) : "");}
 
 if (!skip)if ((ind == (this.obj.rows.length-1))||(!this.rowsCol[ind]))
 if (_isKHTML)this.obj.appendChild(r);else {this.obj.firstChild.appendChild(r);}
 else {this.rowsCol[ind].parentNode.insertBefore(r, this.rowsCol[ind]);}
 
 this.rowsCol._dhx_insertAt(ind, r);this.callEvent("onRowInserted",[r, ind]);return r;},
 
 getRowById:function(id){var row = this.rowsAr[id];if (row){if (row.tagName != "TR"){for (var i = 0;i < this.rowsBuffer.length;i++)if (this.rowsBuffer[i] && this.rowsBuffer[i].idd == id)return this.render_row(i);if (this._h2)return this.render_row(null,row.idd);}
 return row;}
 return null;},
 

 cellById:function(row_id, col){return this.cells(row_id, col);},

 cells:function(row_id, col){if (arguments.length == 0)return this.cells4(this.cell);else
 var c = this.getRowById(row_id);var cell = (c._childIndexes ? c.childNodes[c._childIndexes[col]] : c.childNodes[col]);return this.cells4(cell);},
 
 cellByIndex:function(row_index, col){return this.cells2(row_index, col);},
 
 cells2:function(row_index, col){var c = this.render_row(row_index);var cell = (c._childIndexes ? c.childNodes[c._childIndexes[col]] : c.childNodes[col]);return this.cells4(cell);},
 
 cells3:function(row, col){var cell = (row._childIndexes ? row.childNodes[row._childIndexes[col]] : row.childNodes[col]);return this.cells4(cell);},
 
 cells4:function(cell){var type = window["eXcell_"+(cell._cellType||this.cellType[cell._cellIndex])];if (type)return new type(cell);}, 
 cells5:function(cell, type){var type = type||(cell._cellType||this.cellType[cell._cellIndex]);if (!this._ecache[type]){if (!window["eXcell_"+type])var tex = eXcell_ro;else
 var tex = window["eXcell_"+type];this._ecache[type]=new tex(cell);}
 this._ecache[type].cell=cell;return this._ecache[type];},
 dma:function(mode){if (!this._ecache)this._ecache={};if (mode&&!this._dma){this._dma=this.cells4;this.cells4=this.cells5;}else if (!mode&&this._dma){this.cells4=this._dma;this._dma=null;}
 },
 
 
 getRowsNum:function(){return this.rowsBuffer.length;},
 
 
 
 enableEditTabOnly:function(mode){if (arguments.length > 0)this.smartTabOrder=convertStringToBoolean(mode);else
 this.smartTabOrder=true;},
 
 setExternalTabOrder:function(start, end){var grid = this;this.tabStart=( typeof (start) == "object") ? start : document.getElementById(start);this.tabStart.onkeydown=function(e){var ev = (e||window.event);if (ev.keyCode == 9 && !ev.shiftKey){ev.cancelBubble=true;grid.selectCell(0, 0, 0, 0, 1);if (grid.smartTabOrder && grid.cells2(0, 0).isDisabled()){grid._key_events["k9_0_0"].call(grid);}
 this.blur();return false;}
 };if(_isOpera)this.tabStart.onkeypress = this.tabStart.onkeydown;this.tabEnd=( typeof (end) == "object") ? end : document.getElementById(end);this.tabEnd.onkeydown=this.tabEnd.onkeypress=function(e){var ev = (e||window.event);if (ev.keyCode == 9 && ev.shiftKey){ev.cancelBubble=true;grid.selectCell((grid.getRowsNum()-1), (grid.getColumnCount()-1), 0, 0, 1);if (grid.smartTabOrder && grid.cells2((grid.getRowsNum()-1), (grid.getColumnCount()-1)).isDisabled()){grid._key_events["k9_0_1"].call(grid);}
 this.blur();return false;}
 };if(_isOpera)this.tabEnd.onkeypress = this.tabEnd.onkeydown;},
 
 uid:function(){if (!this._ui_seed)this._ui_seed=(new Date()).valueOf();return this._ui_seed++;},
 
 clearAndLoad:function(){var t=this._pgn_skin;this._pgn_skin=null;this.clearAll();this._pgn_skin=t;this.load.apply(this,arguments);},
 
 getStateOfView:function(){if (this.pagingOn){var start = (this.currentPage-1)*this.rowsBufferOutSize;return [this.currentPage, start, Math.min(start+this.rowsBufferOutSize,this.rowsBuffer.length), this.rowsBuffer.length ];}
 return [
 Math.floor(this.objBox.scrollTop/this._srdh),
 Math.ceil(parseInt(this.objBox.offsetHeight)/this._srdh),
 this.rowsBuffer.length
 ];}
};(function(){function direct_set(name,value){this[name]=value;}
 function direct_call(name,value){this[name].call(this,value);}
 function joined_call(name,value){this[name].call(this,value.join(this.delim));}
 function set_options(name,value){for (var i=0;i < value.length;i++)if (typeof value[i] == "object"){var combo = this.getCombo(i);for (var key in value[i])combo.put(key, value[i][key]);}
 }
 function header_set(name,value,obj){var rows = 1;var header = [];function add(i,j,value){if (!header[j])header[j]=[];if (typeof value == "object")value.toString=function(){return this.text;}
 header[j][i]=value;}
 
 for (var i=0;i<value.length;i++){if (typeof(value[i])=="object" && value[i].length){for (var j=0;j < value[i].length;j++)add(i,j,value[i][j]);}else
 add(i,0,value[i]);}
 for (var i=0;i<header.length;i++)for (var j=0;j<header[0].length;j++){var h=header[i][j];header[i][j]=(h||"").toString()||"&nbsp;";if (h&&h.colspan)for (var k=1;k < h.colspan;k++)add(j+k,i,"#cspan");if (h&&h.rowspan)for (var k=1;k < h.rowspan;k++)add(j,i+k,"#rspan");}
 
 this.setHeader(header[0]);for (var i=1;i < header.length;i++)this.attachHeader(header[i]);}
 
 
 var columns_map=[
 {name:"label", def:"&nbsp;", operation:"setHeader", type:header_set },
 {name:"id", def:"", operation:"columnIds", type:direct_set },
 {name:"width", def:"*", operation:"setInitWidths", type:joined_call },
 {name:"align", def:"left", operation:"cellAlign", type:direct_set },
 {name:"valign", def:"middle", operation:"cellVAlign", type:direct_set },
 {name:"sort", def:"na", operation:"fldSort", type:direct_set },
 {name:"type", def:"ro", operation:"setColTypes", type:joined_call },
 {name:"options",def:"", operation:"", type:set_options }
 ];dhtmlx.extend_api("dhtmlXGridObject",{_init:function(obj){return [obj.parent];},
 image_path:"setImagePath",
 columns:"columns",
 rows:"rows",
 headers:"headers",
 skin:"setSkin",
 smart_rendering:"enableSmartRendering",
 css:"enableAlterCss",
 auto_height:"enableAutoHeight",
 save_hidden:"enableAutoHiddenColumnsSaving",
 save_cookie:"enableAutoSaving",
 save_size:"enableAutoSizeSaving",
 auto_width:"enableAutoWidth",
 block_selection:"enableBlockSelection",
 csv_id:"enableCSVAutoID",
 csv_header:"enableCSVHeader",
 cell_ids:"enableCellIds",
 colspan:"enableColSpan",
 column_move:"enableColumnMove",
 context_menu:"enableContextMenu",
 distributed:"enableDistributedParsing",
 drag:"enableDragAndDrop",
 drag_order:"enableDragOrder",
 tabulation:"enableEditTabOnly",
 header_images:"enableHeaderImages",
 header_menu:"enableHeaderMenu",
 keymap:"enableKeyboardSupport",
 mouse_navigation:"enableLightMouseNavigation",
 markers:"enableMarkedCells",
 math_editing:"enableMathEditing",
 math_serialization:"enableMathSerialization",
 drag_copy:"enableMercyDrag",
 multiline:"enableMultiline",
 multiselect:"enableMultiselect",
 save_column_order:"enableOrderSaving",
 hover:"enableRowsHover",
 rowspan:"enableRowspan",
 smart:"enableSmartRendering",
 save_sorting:"enableSortingSaving",
 stable_sorting:"enableStableSorting",
 undo:"enableUndoRedo",
 csv_cell:"setCSVDelimiter",
 date_format:"setDateFormat",
 drag_behavior:"setDragBehavior",
 editable:"setEditable",
 without_header:"setNoHeader",
 submit_changed:"submitOnlyChanged",
 submit_serialization:"submitSerialization",
 submit_selected:"submitOnlySelected",
 submit_id:"submitOnlyRowID", 
 xml:"load"
 },{columns:function(obj){for (var j=0;j<columns_map.length;j++){var settings = [];for (var i=0;i<obj.length;i++)settings[i]=obj[i][columns_map[j].name]||columns_map[j].def;var type=columns_map[j].type||direct_call;type.call(this,columns_map[j].operation,settings,obj);}
 this.init();},
 rows:function(obj){},
 headers:function(obj){for (var i=0;i < obj.length;i++)this.attachHeader(obj[i]);}
 });})();dhtmlXGridObject.prototype._dp_init=function(dp){dp.attachEvent("insertCallback", function(upd, id) {if (this.obj._h2)this.obj.addRow(id, row, null, parent);else
 this.obj.addRow(id, [], 0);var row = this.obj.getRowById(id);if (row){this.obj._process_xml_row(row, upd.firstChild);this.obj._postRowProcessing(row);}
 });dp.attachEvent("updateCallback", function(upd, id) {var row = this.obj.getRowById(id);if (row){this.obj._process_xml_row(row, upd.firstChild);this.obj._postRowProcessing(row);}
 });dp.attachEvent("deleteCallback", function(upd, id) {this.obj.setUserData(id, this.action_param, "true_deleted");this.obj.deleteRow(id);});dp._methods=["setRowTextStyle","setCellTextStyle","changeRowId","deleteRow"];this.attachEvent("onEditCell",function(state,id,index){if (dp._columns && !dp._columns[index])return true;var cell = this.cells(id,index)
 if (state==1){if(cell.isCheckbox()){dp.setUpdated(id,true)
 }
 }else if (state==2){if(cell.wasChanged()){dp.setUpdated(id,true)
 }
 }
 return true;});this.attachEvent("onRowPaste",function(id){dp.setUpdated(id,true)
 });this.attachEvent("onRowIdChange",function(id,newid){var ind=dp.findRow(id);if (ind<dp.updatedRows.length)dp.updatedRows[ind]=newid;});this.attachEvent("onSelectStateChanged",function(rowId){if(dp.updateMode=="row")dp.sendData();return true;});this.attachEvent("onEnter",function(rowId,celInd){if(dp.updateMode=="row")dp.sendData();return true;});this.attachEvent("onBeforeRowDeleted",function(rowId){if (!this.rowsAr[rowId])return true;if (this.dragContext && dp.dnd){window.setTimeout(function(){dp.setUpdated(rowId,true);},1);return true;}
 var z=dp.getState(rowId);if (this._h2){this._h2.forEachChild(rowId,function(el){dp.setUpdated(el.id,false);dp.markRow(el.id,true,"deleted");},this);}
 if (z=="inserted"){dp.set_invalid(rowId,false);dp.setUpdated(rowId,false);return true;}
 if (z=="deleted")return false;if (z=="true_deleted"){dp.setUpdated(rowId,false);return true;}
 dp.setUpdated(rowId,true,"deleted");return false;});this.attachEvent("onBindUpdate", function(id){dp.setUpdated(id,true);});this.attachEvent("onRowAdded",function(rowId){if (this.dragContext && dp.dnd)return true;dp.setUpdated(rowId,true,"inserted")
 return true;});dp._getRowData=function(rowId,pref){var data = [];data["gr_id"]=rowId;if (this.obj.isTreeGrid())
 data["gr_pid"]=this.obj.getParentId(rowId);var r=this.obj.getRowById(rowId);for (var i=0;i<this.obj._cCount;i++){if (this.obj._c_order)var i_c=this.obj._c_order[i];else
 var i_c=i;var c=this.obj.cells(r.idd,i);if (this._changed && !c.wasChanged()) continue;if (this._endnm)data[this.obj.getColumnId(i)]=c.getValue();else
 data["c"+i_c]=c.getValue();}
 
 var udata=this.obj.UserData[rowId];if (udata){for (var j=0;j<udata.keys.length;j++)if (udata.keys[j] && udata.keys[j].indexOf("__")!=0)
 data[udata.keys[j]]=udata.values[j];}
 var udata=this.obj.UserData["gridglobaluserdata"];if (udata){for (var j=0;j<udata.keys.length;j++)data[udata.keys[j]]=udata.values[j];}
 return data;};dp._clearUpdateFlag=function(rowId){var row=this.obj.getRowById(rowId);if (row)for (var j=0;j<this.obj._cCount;j++)this.obj.cells(rowId,j).cell.wasChanged=false;};dp.checkBeforeUpdate=function(rowId){var valid=true;var c_invalid=[];for (var i=0;i<this.obj._cCount;i++)if (this.mandatoryFields[i]){var res=this.mandatoryFields[i].call(this.obj,this.obj.cells(rowId,i).getValue(),rowId,i);if (typeof res == "string"){this.messages.push(res);valid = false;}else {valid&=res;c_invalid[i]=!res;}
 }
 if (!valid){this.set_invalid(rowId,"invalid",c_invalid);this.setUpdated(rowId,false);}
 return valid;};};function dhtmlXGridCellObject(obj){this.destructor=function(){this.cell.obj=null;this.cell=null;this.grid=null;this.base=null;return null;}
 this.cell=obj;this.getValue=function(){if ((this.cell.firstChild)&&(this.cell.firstChild.tagName == "TEXTAREA"))
 return this.cell.firstChild.value;else
 return this.cell.innerHTML._dhx_trim();}
 
 this.getMathValue=function(){if (this.cell.original)return this.cell.original;else
 return this.getValue();}
 

 
 this.getFont=function(){arOut=new Array(3);if (this.cell.style.fontFamily)arOut[0]=this.cell.style.fontFamily

 if (this.cell.style.fontWeight == 'bold'||this.cell.parentNode.style.fontWeight == 'bold')arOut[1]='bold';if (this.cell.style.fontStyle == 'italic'||this.cell.parentNode.style.fontWeight == 'italic')arOut[1]+='italic';if (this.cell.style.fontSize)arOut[2]=this.cell.style.fontSize
 else
 arOut[2]="";return arOut.join("-")
 }
 
 this.getTextColor=function(){if (this.cell.style.color)return this.cell.style.color
 else
 return "#000000";}
 
 this.getBgColor=function(){if (this.cell.bgColor)return this.cell.bgColor
 else
 return "#FFFFFF";}
 
 this.getHorAlign=function(){if (this.cell.style.textAlign)return this.cell.style.textAlign;else if (this.cell.style.textAlign)return this.cell.style.textAlign;else
 return "left";}
 
 this.getWidth=function(){return this.cell.scrollWidth;}
 
 this.setFont=function(val){fntAr=val.split("-");this.cell.style.fontFamily=fntAr[0];this.cell.style.fontSize=fntAr[fntAr.length-1]

 if (fntAr.length == 3){if (/bold/.test(fntAr[1]))
 this.cell.style.fontWeight="bold";if (/italic/.test(fntAr[1]))
 this.cell.style.fontStyle="italic";if (/underline/.test(fntAr[1]))
 this.cell.style.textDecoration="underline";}
 }
 
 this.setTextColor=function(val){this.cell.style.color=val;}
 
 this.setBgColor=function(val){if (val == "")val=null;this.cell.bgColor=val;}
 
 this.setHorAlign=function(val){if (val.length == 1){if (val == 'c')this.cell.style.textAlign='center'

 else if (val == 'l')this.cell.style.textAlign='left';else
 this.cell.style.textAlign='right';}else
 this.cell.style.textAlign=val
 }
 
 this.wasChanged=function(){if (this.cell.wasChanged)return true;else
 return false;}
 
 this.isCheckbox=function(){var ch = this.cell.firstChild;if (ch&&ch.tagName == 'INPUT'){type=ch.type;if (type == 'radio'||type == 'checkbox')return true;else
 return false;}else
 return false;}
 
 this.isChecked=function(){if (this.isCheckbox()){return this.cell.firstChild.checked;}
 }
 
 this.isDisabled=function(){return this.cell._disabled;}
 
 this.setChecked=function(fl){if (this.isCheckbox()){if (fl != 'true'&&fl != 1)fl=false;this.cell.firstChild.checked=fl;}
 }
 
 this.setDisabled=function(fl){if (fl != 'true'&&fl != 1)fl=false;if (this.isCheckbox()){this.cell.firstChild.disabled=fl;if (this.disabledF)this.disabledF(fl);}
 this.cell._disabled=fl;}
}
dhtmlXGridCellObject.prototype={getAttribute: function(name){return this.cell._attrs[name];},
 setAttribute: function(name, value){this.cell._attrs[name]=value;},
 getInput:function(){if (this.obj && (this.obj.tagName=="INPUT" || this.obj.tagName=="TEXTAREA")) return this.obj;var inps=(this.obj||this.cell).getElementsByTagName("TEXTAREA");if (!inps.length)inps=(this.obj||this.cell).getElementsByTagName("INPUT");return inps[0];}
}
dhtmlXGridCellObject.prototype.setValue=function(val){if (( typeof (val)!= "number")&&(!val||val.toString()._dhx_trim() == "")){val="&nbsp;"
 this.cell._clearCell=true;}else
 this.cell._clearCell=false;this.setCValue(val);}
dhtmlXGridCellObject.prototype.getTitle=function(){return (_isIE ? this.cell.innerText : this.cell.textContent);}
dhtmlXGridCellObject.prototype.setCValue=function(val, val2){this.cell.innerHTML=val;}
dhtmlXGridCellObject.prototype.setCTxtValue=function(val){this.cell.innerHTML="";this.cell.appendChild(document.createTextNode(val));}
dhtmlXGridCellObject.prototype.setLabel=function(val){this.cell.innerHTML=val;}
dhtmlXGridCellObject.prototype.getMath=function(){if (this._val)return this.val;else
 return this.getValue();}
function eXcell(){this.obj=null;this.val=null;this.changeState=function(){return false
 }
 
 this.edit=function(){this.val=this.getValue()
 }
 
 this.detach=function(){return false
 }
 
 this.getPosition=function(oNode){var oCurrentNode = oNode;var iLeft = 0;var iTop = 0;while (oCurrentNode.tagName != "BODY"){iLeft+=oCurrentNode.offsetLeft;iTop+=oCurrentNode.offsetTop;oCurrentNode=oCurrentNode.offsetParent;}
 return new Array(iLeft, iTop);}
}
eXcell.prototype=new dhtmlXGridCellObject;function eXcell_ed(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.edit=function(){this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF)) ? "INPUT" : "TEXTAREA";this.val=this.getValue();this.obj=document.createElement(this.cell.atag);this.obj.setAttribute("autocomplete", "off");this.obj.style.height=(this.cell.offsetHeight-(_isIE ? 4 : 4))+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(e){(e||event).cancelBubble=true
 }
 this.obj.onmousedown=function(e){(e||event).cancelBubble=true
 }
 this.obj.value=this.val
 this.cell.innerHTML="";this.cell.appendChild(this.obj);this.obj.onselectstart=function(e){if (!e)e=event;e.cancelBubble=true;return true;};if (_isIE)this.obj.focus();this.obj.focus()
 }
 this.getValue=function(){if ((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName == this.cell.atag)))
 return this.cell.firstChild.value;if (this.cell._clearCell)return "";return this.cell.innerHTML.toString()._dhx_trim();}
 this.detach=function(){this.setValue(this.obj.value);return this.val != this.getValue();}
}
eXcell_ed.prototype=new eXcell;function eXcell_edtxt(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.getValue=function(){if ((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName == this.cell.atag)))
 return this.cell.firstChild.value;if (this.cell._clearCell)return "";return (_isIE ? this.cell.innerText : this.cell.textContent);}
 this.setValue=function(val){if (!val||val.toString()._dhx_trim() == ""){val=" ";this.cell._clearCell=true;}else
 this.cell._clearCell=false;this.setCTxtValue(val);}
}
eXcell_edtxt.prototype=new eXcell_ed;function eXcell_ch(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.disabledF=function(fl){if ((fl == true)||(fl == 1))
 this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0.", "item_chk0_dis.").replace("item_chk1.",
 "item_chk1_dis.");else
 this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0_dis.", "item_chk0.").replace("item_chk1_dis.",
 "item_chk1.");}
 this.changeState=function(fromClick){if (fromClick===true && !this.grid.isActive){if (window.globalActiveDHTMLGridObject != null && window.globalActiveDHTMLGridObject != this.grid && window.globalActiveDHTMLGridObject.isActive)window.globalActiveDHTMLGridObject.setActive(false);this.grid.setActive(true);}
 if ((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled()))
 return;if (this.grid.callEvent("onEditCell", [
 0,
 this.cell.parentNode.idd,
 this.cell._cellIndex
 ])){this.val=this.getValue()

 if (this.val == "1")this.setValue("0")
 else
 this.setValue("1")

 this.cell.wasChanged=true;this.grid.callEvent("onEditCell", [
 1,
 this.cell.parentNode.idd,
 this.cell._cellIndex
 ]);this.grid.callEvent("onCheckbox", [
 this.cell.parentNode.idd,
 this.cell._cellIndex,
 (this.val != '1')
 ]);this.grid.callEvent("onCheck", [
 this.cell.parentNode.idd,
 this.cell._cellIndex,
 (this.val != '1')
 ]);}else {this.editor=null;}
 }
 this.getValue=function(){return this.cell.chstate ? this.cell.chstate.toString() : "0";}
 this.isCheckbox=function(){return true;}
 this.isChecked=function(){if (this.getValue()== "1")
 return true;else
 return false;}
 this.setChecked=function(fl){this.setValue(fl.toString())
 }
 this.detach=function(){return this.val != this.getValue();}
 this.edit=null;}
eXcell_ch.prototype=new eXcell;eXcell_ch.prototype.setValue=function(val){this.cell.style.verticalAlign="middle";if (val){val=val.toString()._dhx_trim();if ((val == "false")||(val == "0"))
 val="";}
 if (val){val="1";this.cell.chstate="1";}else {val="0";this.cell.chstate="0"
 }
 var obj = this;this.setCValue("<img src='"+this.grid.imgURL+"item_chk"+val
 +".gif' onclick='new eXcell_ch(this.parentNode).changeState(true);(arguments[0]||event).cancelBubble=true;'>",
 this.cell.chstate);}
function eXcell_ra(cell){this.base=eXcell_ch;this.base(cell)
 this.grid=cell.parentNode.grid;this.disabledF=function(fl){if ((fl == true)||(fl == 1))
 this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0.", "radio_chk0_dis.").replace("radio_chk1.",
 "radio_chk1_dis.");else
 this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0_dis.", "radio_chk0.").replace("radio_chk1_dis.",
 "radio_chk1.");}
 this.changeState=function(mode){if (mode===false && this.getValue()==1) return;if ((!this.grid.isEditable)||(this.cell.parentNode._locked))
 return;if (this.grid.callEvent("onEditCell", [
 0,
 this.cell.parentNode.idd,
 this.cell._cellIndex
 ])!= false){this.val=this.getValue()

 if (this.val == "1")this.setValue("0")
 else
 this.setValue("1")
 this.cell.wasChanged=true;this.grid.callEvent("onEditCell", [
 1,
 this.cell.parentNode.idd,
 this.cell._cellIndex
 ]);this.grid.callEvent("onCheckbox", [
 this.cell.parentNode.idd,
 this.cell._cellIndex,
 (this.val != '1')
 ]);this.grid.callEvent("onCheck", [
 this.cell.parentNode.idd,
 this.cell._cellIndex,
 (this.val != '1')
 ]);}else {this.editor=null;}
 }
 this.edit=null;}
eXcell_ra.prototype=new eXcell_ch;eXcell_ra.prototype.setValue=function(val){this.cell.style.verticalAlign="middle";if (val){val=val.toString()._dhx_trim();if ((val == "false")||(val == "0"))
 val="";}
 if (val){if (!this.grid._RaSeCol)this.grid._RaSeCol=[];if (this.grid._RaSeCol[this.cell._cellIndex]){var z = this.grid.cells4(this.grid._RaSeCol[this.cell._cellIndex]);z.setValue("0")
 if (this.grid.rowsAr[z.cell.parentNode.idd])this.grid.callEvent("onEditCell", [
 1,
 z.cell.parentNode.idd,
 z.cell._cellIndex
 ]);}
 this.grid._RaSeCol[this.cell._cellIndex]=this.cell;val="1";this.cell.chstate="1";}else {val="0";this.cell.chstate="0"
 }
 this.setCValue("<img src='"+this.grid.imgURL+"radio_chk"+val+".gif' onclick='new eXcell_ra(this.parentNode).changeState(false);'>",
 this.cell.chstate);}
function eXcell_txt(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.edit=function(){this.val=this.getValue()
 this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_textarea";this.obj.onclick=function(e){(e||event).cancelBubble=true
 }
 var arPos = this.grid.getPosition(this.cell);this.obj.value=this.val;this.obj.style.display="";this.obj.style.textAlign=this.cell.style.textAlign;if (_isFF){var z_ff = document.createElement("DIV");z_ff.appendChild(this.obj);z_ff.style.overflow="auto";z_ff.className="dhx_textarea";this.obj.style.margin="0px 0px 0px 0px";this.obj.style.border="0px";this.obj=z_ff;}
 document.body.appendChild(this.obj);if(_isOpera)this.obj.onkeypress=function(ev){if (ev.keyCode == 9)return false;}
 this.obj.onkeydown=function(e){var ev = (e||event);if (ev.keyCode == 9){globalActiveDHTMLGridObject.entBox.focus();globalActiveDHTMLGridObject.doKey({keyCode: ev.keyCode,
 shiftKey: ev.shiftKey,
 srcElement: "0"
 });return false;}
 }
 this.obj.style.left=arPos[0]+"px";this.obj.style.top=arPos[1]+this.cell.offsetHeight+"px";if (this.cell.offsetWidth < 200)var pw = 200;else
 var pw = this.cell.offsetWidth;this.obj.style.width=pw+(_isFF ? 18 : 16)+"px"

 if (_isFF){this.obj.firstChild.style.width=parseInt(this.obj.style.width)+"px";this.obj.firstChild.style.height=this.obj.offsetHeight-3+"px";}
 if (_isIE){this.obj.select();this.obj.value=this.obj.value;}
 if (_isFF)this.obj.firstChild.focus();else {this.obj.focus()
 }
 }
 this.detach=function(){var a_val = "";if (_isFF)a_val=this.obj.firstChild.value;else
 a_val=this.obj.value;if (a_val == ""){this.cell._clearCell=true;}
 else
 this.cell._clearCell=false;this.setValue(a_val);document.body.removeChild(this.obj);this.obj=null;return this.val != this.getValue();}
 this.getValue=function(){if (this.obj){if (_isFF)return this.obj.firstChild.value;else
 return this.obj.value;}
 
 if (this.cell._clearCell)return "";if ((!this.grid.multiLine))
 return this.cell._brval||this.cell.innerHTML;else
 return this.cell.innerHTML.replace(/<br[^>]*>/gi, "\n")._dhx_trim();}
}
eXcell_txt.prototype=new eXcell;function eXcell_txttxt(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.getValue=function(){if ((this.cell.firstChild)&&(this.cell.firstChild.tagName == "TEXTAREA"))
 return this.cell.firstChild.value;if (this.cell._clearCell)return "";if ((!this.grid.multiLine)&&this.cell._brval)
 return this.cell._brval;return (_isIE ? this.cell.innerText : this.cell.textContent);}
 this.setValue=function(val){this.cell._brval=val;if (!val||val.toString()._dhx_trim() == ""){val=" ";this.cell._clearCell=true;}else
 this.cell._clearCell=false;this.setCTxtValue(val);}
}
eXcell_txttxt.prototype=new eXcell_txt;eXcell_txt.prototype.setValue=function(val){if (!val||val.toString()._dhx_trim() == ""){val="&nbsp;"
 this.cell._clearCell=true;}else
 this.cell._clearCell=false;this.cell._brval=val;if ((!this.grid.multiLine))
 this.setCValue(val, val);else
 this.setCValue(val.replace(/\n/g, "<br/>"), val);}
function eXcell_co(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;this.combo=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex));this.editable=true
 }
 this.shiftNext=function(){var z = this.list.options[this.list.selectedIndex+1];if (z)z.selected=true;this.obj.value=this.list.options[this.list.selectedIndex].text;return true;}
 this.shiftPrev=function(){if (this.list.selectedIndex != 0){var z = this.list.options[this.list.selectedIndex-1];if (z)z.selected=true;this.obj.value=this.list.options[this.list.selectedIndex].text;}
 return true;}
 this.edit=function(){this.val=this.getValue();this.text=this.getText()._dhx_trim();var arPos = this.grid.getPosition(this.cell) 

 this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_combo_edit";this.obj.style.height=(this.cell.offsetHeight-4)+"px";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(e){(e||event).cancelBubble=true
 }
 this.obj.onmousedown=function(e){(e||event).cancelBubble=true
 }
 this.obj.value=this.text
 this.obj.onselectstart=function(e){if (!e)e=event;e.cancelBubble=true;return true;};var editor_obj = this;this.obj.onkeyup=function(e){var key=(e||event).keyCode;if (key==38 || key==40 || key==9)return;var val = this.readonly ? String.fromCharCode(key) : this.value;var c = editor_obj.list.options;for (var i = 0;i < c.length;i++)if (c[i].text.indexOf(val)== 0)
 return c[i].selected=true;}
 this.list=document.createElement("SELECT");this.list.className='dhx_combo_select';this.list.style.width=this.cell.offsetWidth+"px";this.list.style.left=arPos[0]+"px";this.list.style.top=arPos[1]+this.cell.offsetHeight+"px";this.list.onclick=function(e){var ev = e||window.event;var cell = ev.target||ev.srcElement

 
 if (cell.tagName == "OPTION")cell=cell.parentNode;editor_obj.editable=false;editor_obj.grid.editStop();ev.cancelBubble = true;}
 var comboKeys = this.combo.getKeys();var fl = false
 var selOptId = 0;for (var i = 0;i < comboKeys.length;i++){var val = this.combo.get(comboKeys[i])
 this.list.options[this.list.options.length]=new Option(val, comboKeys[i]);if (comboKeys[i] == this.val){selOptId=this.list.options.length-1;fl=true;}
 }
 if (fl == false){this.list.options[this.list.options.length]=new Option(this.text, this.val === null ? "" : this.val);selOptId=this.list.options.length-1;}
 document.body.appendChild(this.list) 
 this.list.size="6";this.cstate=1;if (this.editable){this.cell.innerHTML="";}
 else {this.obj.style.width="1px";this.obj.style.height="1px";}
 this.cell.appendChild(this.obj);this.list.options[selOptId].selected=true;if ((!_isFF)||(this.editable)){this.obj.focus();this.obj.focus();}
 if (!this.editable){this.obj.style.visibility="hidden";this.list.focus();this.list.onkeydown=function(e){e=e||window.event;editor_obj.grid.setActive(true)

 if (e.keyCode < 30)return editor_obj.grid.doKey({target: editor_obj.cell,
 keyCode: e.keyCode,
 shiftKey: e.shiftKey,
 ctrlKey: e.ctrlKey
 })
 }
 }
 }
 this.getValue=function(){return ((this.cell.combo_value == window.undefined) ? "" : this.cell.combo_value);}
 this.detach=function(){if (this.val != this.getValue()){this.cell.wasChanged=true;}
 if (this.list.parentNode != null){if (this.editable){var ind = this.list.options[this.list.selectedIndex]
 if (ind&&ind.text == this.obj.value)this.setValue(this.list.value)
 else{var combo=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex));var val=combo.values._dhx_find(this.obj.value);if (val!=-1)this.setValue(combo.keys[val]);else this.setCValue(this.cell.combo_value=this.obj.value);}
 }
 else
 this.setValue(this.list.value)
 }
 if (this.list.parentNode)this.list.parentNode.removeChild(this.list);if (this.obj.parentNode)this.obj.parentNode.removeChild(this.obj);return this.val != this.getValue();}
}
eXcell_co.prototype=new eXcell;eXcell_co.prototype.getText=function(){return this.cell.innerHTML;}
eXcell_co.prototype.setValue=function(val){if (typeof (val)== "object"){var optCol = this.grid.xmlLoader.doXPath("./option", val);if (optCol.length)this.cell._combo=new dhtmlXGridComboObject();for (var j = 0;j < optCol.length;j++)this.cell._combo.put(optCol[j].getAttribute("value"),
 optCol[j].firstChild
 ? optCol[j].firstChild.data
 : "");val=val.firstChild.data;}
 if ((val||"").toString()._dhx_trim() == "")
 val=null
 this.cell.combo_value=val;if (val !== null){var label = (this.cell._combo||this.grid.getCombo(this.cell._cellIndex)).get(val);this.setCValue(label===null?val:label, val);}else
 this.setCValue("&nbsp;", val);}
function eXcell_coro(cell){this.base=eXcell_co;this.base(cell)
 this.editable=false;}
eXcell_coro.prototype=new eXcell_co;function eXcell_cotxt(cell){this.base=eXcell_co;this.base(cell)
}
eXcell_cotxt.prototype=new eXcell_co;eXcell_cotxt.prototype.getText=function(){return (_isIE ? this.cell.innerText : this.cell.textContent);}
eXcell_cotxt.prototype.setValue=function(val){if (typeof (val)== "object"){var optCol = this.grid.xmlLoader.doXPath("./option", val);if (optCol.length)this.cell._combo=new dhtmlXGridComboObject();for (var j = 0;j < optCol.length;j++)this.cell._combo.put(optCol[j].getAttribute("value"),
 optCol[j].firstChild
 ? optCol[j].firstChild.data
 : "");val=val.firstChild.data;}
 if ((val||"").toString()._dhx_trim() == "")
 val=null

 if (val !== null)this.setCTxtValue((this.cell._combo||this.grid.getCombo(this.cell._cellIndex)).get(val)||val, val);else
 this.setCTxtValue(" ", val);this.cell.combo_value=val;}
function eXcell_corotxt(cell){this.base=eXcell_co;this.base(cell)
 this.editable=false;}
eXcell_corotxt.prototype=new eXcell_cotxt;function eXcell_cp(cell){try{this.cell=cell;this.grid=this.cell.parentNode.grid;}
 catch (er){}
 this.edit=function(){this.val=this.getValue()
 this.obj=document.createElement("SPAN");this.obj.style.border="1px solid black";this.obj.style.position="absolute";var arPos = this.grid.getPosition(this.cell);this.colorPanel(4, this.obj)
 document.body.appendChild(this.obj);this.obj.style.left=arPos[0]+"px";this.obj.style.zIndex=1000;this.obj.style.top=arPos[1]+this.cell.offsetHeight+"px";}
 this.toolDNum=function(value){if (value.length == 1)value='0'+value;return value;}
 this.colorPanel=function(index, parent){var tbl = document.createElement("TABLE");parent.appendChild(tbl)
 tbl.cellSpacing=0;tbl.editor_obj=this;tbl.style.cursor="default";tbl.onclick=function(e){var ev = e||window.event
 var cell = ev.target||ev.srcElement;var ed = cell.parentNode.parentNode.parentNode.editor_obj
 ed.setValue(cell._bg)
 ed.grid.editStop();}
 var cnt = 256 / index;for (var j = 0;j <= (256 / cnt);j++){var r = tbl.insertRow(j);for (var i = 0;i <= (256 / cnt);i++){for (var n = 0;n <= (256 / cnt);n++){R=new Number(cnt*j)-(j == 0 ? 0 : 1)
 G=new Number(cnt*i)-(i == 0 ? 0 : 1)
 B=new Number(cnt*n)-(n == 0 ? 0 : 1)
 var rgb =
 this.toolDNum(R.toString(16))+""+this.toolDNum(G.toString(16))+""+this.toolDNum(B.toString(16));var c = r.insertCell(i);c.width="10px";c.innerHTML="&nbsp;";c.title=rgb.toUpperCase()
 c.style.backgroundColor="#"+rgb
 c._bg="#"+rgb;if (this.val != null&&"#"+rgb.toUpperCase()== this.val.toUpperCase()){c.style.border="2px solid white"
 }
 }
 }
 }
 }
 this.getValue=function(){return this.cell.firstChild._bg||"";}
 this.getRed=function(){return Number(parseInt(this.getValue().substr(1, 2), 16))
 }
 this.getGreen=function(){return Number(parseInt(this.getValue().substr(3, 2), 16))
 }
 this.getBlue=function(){return Number(parseInt(this.getValue().substr(5, 2), 16))
 }
 this.detach=function(){if (this.obj.offsetParent != null)document.body.removeChild(this.obj);return this.val != this.getValue();}
}
eXcell_cp.prototype=new eXcell;eXcell_cp.prototype.setValue=function(val){this.setCValue("<div style='width:100%;height:"+((this.grid.multiLine?this.cell.offsetHeight-2:16))+";background-color:"+(val||"")
 +";border:0px;'>&nbsp;</div>",
 val);this.cell.firstChild._bg=val;}
function eXcell_img(cell){try{this.cell=cell;this.grid=this.cell.parentNode.grid;}
 catch (er){}
 this.getValue=function(){if (this.cell.firstChild.tagName == "IMG")return this.cell.firstChild.src+(this.cell.titFl != null
 ? "^"+this.cell._brval
 : "");else if (this.cell.firstChild.tagName == "A"){var out = this.cell.firstChild.firstChild.src+(this.cell.titFl != null ? "^"+this.cell._brval : "");out+="^"+this.cell.lnk;if (this.cell.trg)out+="^"+this.cell.trg
 return out;}
 }
 this.isDisabled=function(){return true;}
}
eXcell_img.prototype=new eXcell;eXcell_img.prototype.getTitle=function(){return this.cell._brval
}
eXcell_img.prototype.setValue=function(val){var title = val;if (val.indexOf("^")!= -1){var ar = val.split("^");val=ar[0]
 title=this.cell._attrs.title||ar[1];if (ar.length > 2){this.cell.lnk=ar[2]

 if (ar[3])this.cell.trg=ar[3]
 }
 this.cell.titFl="1";}
 this.setCValue("<img src='"+this.grid.iconURL+(val||"")._dhx_trim()+"' border='0'>", val);if (this.cell.lnk){this.cell.innerHTML="<a href='"+this.cell.lnk+"' target='"+this.cell.trg+"'>"+this.cell.innerHTML+"</a>"
 }
 this.cell._brval=title;}
function eXcell_price(cell){this.base=eXcell_ed;this.base(cell)
 this.getValue=function(){if (this.cell.childNodes.length > 1)return this.cell.childNodes[1].innerHTML.toString()._dhx_trim()
 else
 return "0";}
}
eXcell_price.prototype=new eXcell_ed;eXcell_price.prototype.setValue=function(val){if (isNaN(parseFloat(val))){val=this.val||0;}
 var color = "green";if (val < 0)color="red";this.setCValue("<span>$</span><span style='padding-right:2px;color:"+color+";'>"+val+"</span>", val);}
function eXcell_dyn(cell){this.base=eXcell_ed;this.base(cell)
 this.getValue=function(){return this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim()
 }
}
eXcell_dyn.prototype=new eXcell_ed;eXcell_dyn.prototype.setValue=function(val){if (!val||isNaN(Number(val))){if (val!=="")val=0;}
 if (val > 0){var color = "green";var img = "dyn_up.gif";}else if (val == 0){var color = "black";var img = "dyn_.gif";}else {var color = "red";var img = "dyn_down.gif";}
 this.setCValue("<div style='position:relative;padding-right:2px;width:100%;overflow:hidden;white-space:nowrap;'><img src='"+this.grid.imgURL+""+img
 +"' height='15' style='position:absolute;top:0px;left:0px;'><span style=' padding-left:20px;width:100%;color:"+color+";'>"+val
 +"</span></div>",
 val);}
function eXcell_ro(cell){if (cell){this.cell=cell;this.grid=this.cell.parentNode.grid;}
 this.edit=function(){}
 this.isDisabled=function(){return true;}
 this.getValue=function(){return this.cell._clearCell?"":this.cell.innerHTML.toString()._dhx_trim();}
}
eXcell_ro.prototype=new eXcell;function eXcell_ron(cell){this.cell=cell;this.grid=this.cell.parentNode.grid;this.edit=function(){}
 this.isDisabled=function(){return true;}
 this.getValue=function(){return this.cell._clearCell?"":this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex);}
}
eXcell_ron.prototype=new eXcell;eXcell_ron.prototype.setValue=function(val){if (val === 0){}
 else if (!val||val.toString()._dhx_trim() == ""){this.setCValue("&nbsp;");return this.cell._clearCell=true;}
 this.cell._clearCell=false;this.setCValue(val?this.grid._aplNF(val, this.cell._cellIndex):"0");}
function eXcell_rotxt(cell){this.cell=cell;this.grid=this.cell.parentNode.grid;this.edit=function(){}
 this.isDisabled=function(){return true;}
 this.setValue=function(val){if (!val){val=" ";this.cell._clearCell = true;}
 else
 this.cell._clearCell = false;this.setCTxtValue(val);}
 this.getValue=function(){if (this.cell._clearCell)return "";return (_isIE ? this.cell.innerText : this.cell.textContent);}
}
eXcell_rotxt.prototype=new eXcell;function dhtmlXGridComboObject(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();this.put=function(key, value){for (var i = 0;i < this.keys.length;i++){if (this.keys[i] == key){this.values[i]=value;return true;}
 }
 this.values[this.values.length]=value;this.keys[this.keys.length]=key;}
 
 this.get=function(key){for (var i = 0;i < this.keys.length;i++){if (this.keys[i] == key){return this.values[i];}
 }
 return null;}
 
 this.clear=function(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();}
 
 this.remove=function(key){for (var i = 0;i < this.keys.length;i++){if (this.keys[i] == key){this.keys._dhx_removeAt(i);this.values._dhx_removeAt(i);return true;}
 }
 }
 
 this.size=function(){var j = 0;for (var i = 0;i < this.keys.length;i++){if (this.keys[i] != null)j++;}
 return j;}
 
 this.getKeys=function(){var keyAr = new Array(0);for (var i = 0;i < this.keys.length;i++){if (this.keys[i] != null)keyAr[keyAr.length]=this.keys[i];}
 return keyAr;}
 
 this.save=function(){this._save=new Array();for (var i = 0;i < this.keys.length;i++)this._save[i]=[
 this.keys[i],
 this.values[i]
 ];}
 
 this.restore=function(){if (this._save){this.keys[i]=new Array();this.values[i]=new Array();for (var i = 0;i < this._save.length;i++){this.keys[i]=this._save[i][0];this.values[i]=this._save[i][1];}
 }
 }
 return this;}
function Hashtable(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();return this;}
Hashtable.prototype=new dhtmlXGridComboObject;dhtmlXGridObject.prototype.filterBy=function(column, value, preserve){if (this.isTreeGrid()) return this.filterTreeBy(column, value, preserve);if (this._f_rowsBuffer){if (!preserve){this.rowsBuffer=dhtmlxArray([].concat(this._f_rowsBuffer));if (this._fake)this._fake.rowsBuffer=this.rowsBuffer;}
 }else
 this._f_rowsBuffer=[].concat(this.rowsBuffer);if (!this.rowsBuffer.length)return;var d=true;this.dma(true)
 if (typeof(column)=="object")
 for (var j=0;j<value.length;j++)this._filterA(column[j],value[j]);else
 this._filterA(column,value);this.dma(false)
 if (this.pagingOn && this.rowsBuffer.length/this.rowsBufferOutSize < (this.currentPage-1)) this.changePage(0);this._reset_view();this.callEvent("onGridReconstructed",[])
}
dhtmlXGridObject.prototype._filterA=function(column,value){if (value=="")return;var d=true;if (typeof(value)=="function") d=false;else value=(value||"").toString().toLowerCase();if (!this.rowsBuffer.length)return;for (var i=this.rowsBuffer.length-1;i>=0;i--)if (d?(this._get_cell_value(this.rowsBuffer[i],column).toString().toLowerCase().indexOf(value)==-1):(!value.call(this, this._get_cell_value(this.rowsBuffer[i],column),this.rowsBuffer[i].idd)))
 this.rowsBuffer.splice(i,1);}
dhtmlXGridObject.prototype.getFilterElement=function(index){if (!this.filters)return;for (var i=0;i < this.filters.length;i++){if (this.filters[i][1]==index)return (this.filters[i][0].combo||this.filters[i][0]);};return null;}
dhtmlXGridObject.prototype.collectValues=function(column){var value=this.callEvent("onCollectValues",[column]);if (value!==true)return value;if (this.isTreeGrid()) return this.collectTreeValues(column);this.dma(true)
 this._build_m_order();column=this._m_order?this._m_order[column]:column;var c={};var f=[];var col=this._f_rowsBuffer||this.rowsBuffer;for (var i=0;i<col.length;i++){var val=this._get_cell_value(col[i],column);if (val && (!col[i]._childIndexes || col[i]._childIndexes[column]!=col[i]._childIndexes[column-1])) c[val]=true;}
 this.dma(false);var vals= (this.combos[column]||(this._col_combos?this._col_combos[column]:false));for (var d in c)if (c[d]===true){if(vals){if(vals.get&&vals.get(d)){d = vals.get(d);}
 else if(vals.getOption&&vals.getOption(d)){d = vals.getOption(d).text;}
 }
 f.push(d);}
 
 return f.sort();}
dhtmlXGridObject.prototype._build_m_order=function(){if (this._c_order){this._m_order=[]
 for (var i=0;i < this._c_order.length;i++){this._m_order[this._c_order[i]]=i;};}
}
dhtmlXGridObject.prototype.filterByAll=function(){var a=[];var b=[];this._build_m_order();for (var i=0;i<this.filters.length;i++){if (ind >= this._cCount)continue;var ind=this._m_order?this._m_order[this.filters[i][1]]:this.filters[i][1];b.push(ind);var val=this.filters[i][0]._filter?this.filters[i][0]._filter():this.filters[i][0].value;var vals;if (typeof val != "function" && (vals=(this.combos[ind]||(this._col_combos?this._col_combos[ind]:false)))){if(vals.values){ind=vals.values._dhx_find(val);val=(ind==-1)?val:vals.keys[ind];}
 else if(vals.getOptionByLabel){val=(vals.getOptionByLabel(val)?vals.getOptionByLabel(val).value:val);}
 }
 a.push(val);}
 if (!this.callEvent("onFilterStart",[b,a])) return;this.filterBy(b,a);if (this._cssEven)this._fixAlterCss();this.callEvent("onFilterEnd",[this.filters]);if (this._f_rowsBuffer && this.rowsBuffer.length == this._f_rowsBuffer.length)this._f_rowsBuffer = null;}
dhtmlXGridObject.prototype.makeFilter=function(id,column,preserve){if (!this.filters)this.filters=[];if (typeof(id)!="object")
 id=document.getElementById(id);if(!id)return;var self=this;if (!id.style.width)id.style.width = "90%";if (id.tagName=='SELECT'){this.filters.push([id,column]);this._loadSelectOptins(id,column);id.onchange=function(){self.filterByAll();}
 if(_isIE)id.style.marginTop="1px";this.attachEvent("onEditCell",function(stage,a,ind){this._build_m_order();if (stage==2 && this.filters && ( this._m_order?(ind==this._m_order[column]):(ind==column) ))
 this._loadSelectOptins(id,column);return true;});}
 else if (id.tagName=='INPUT'){this.filters.push([id,column]);id.old_value = id.value='';id.onkeydown=function(){if (this._timer)window.clearTimeout(this._timer);this._timer=window.setTimeout(function(){if (id.value != id.old_value){self.filterByAll();id.old_value=id.value;}
 },500);};}
 else if (id.tagName=='DIV' && id.className=="combo"){this.filters.push([id,column]);id.style.padding="0px";id.style.margin="0px";if (!window.dhx_globalImgPath)window.dhx_globalImgPath=this.imgURL;var z=new dhtmlXCombo(id,"_filter","90%");z.filterSelfA=z.filterSelf;z.filterSelf=function(){if (this.getSelectedIndex()==0) this.setComboText("");this.filterSelfA.apply(this,arguments);this.optionsArr[0].hide(false);}
 
 
 z.enableFilteringMode(true);id.combo=z;id.value="";this._loadComboOptins(id,column);z.attachEvent("onChange",function(){id.value=z.getSelectedValue();if (id.value === null)id.value = "";self.filterByAll();});}
 if (id.parentNode)id.parentNode.className+=" filter";this._filters_ready();}
 
 dhtmlXGridObject.prototype.findCell=function(value, c_ind, count, compare){var compare = compare || (function(master, check){return check.toString().toLowerCase().indexOf(master) != -1;});if (compare === true)compare = function(master, check){return check.toString().toLowerCase() == master;};var res = new Array();value=value.toString().toLowerCase();if (typeof count != "number")count = count?1:0;if (!this.rowsBuffer.length)return res;for (var i = (c_ind||0);i < this._cCount;i++){if (this._h2)this._h2.forEachChild(0,function(el){if (count && res.length==count)return res;if (compare(value, this._get_cell_value(el.buff,i))){res.push([el.id,i]);}
 },this)
 else
 for (var j=0;j < this.rowsBuffer.length;j++)if (compare(value, this._get_cell_value(this.rowsBuffer[j],i))){res.push([this.rowsBuffer[j].idd,i]);if (count && res.length==count)return res;}
 
 
 
 if (typeof (c_ind)!= "undefined")
 return res;}
 
 return res;}
 

dhtmlXGridObject.prototype.makeSearch=function(id,column,strict){if (typeof(id)!="object")
 id=document.getElementById(id);if(!id)return;var self=this;if (id.tagName=='INPUT'){id.onkeypress=function(){if (this._timer)window.clearTimeout(this._timer);this._timer=window.setTimeout(function(){if (id.value=="")return;var z=self.findCell(id.value,column,true,strict);if (z.length){if (self._h2)self.openItem(z[0][0]);self.selectCell(self.getRowIndex(z[0][0]),(column||0))
 }
 },500);};}
 if (id.parentNode)id.parentNode.className+=" filter";}
 
dhtmlXGridObject.prototype._loadSelectOptins=function(t,c){var l=this.collectValues(c);var v=t.value;t.innerHTML="";t.options[0]=new Option("","");var f=this._filter_tr?this._filter_tr[c]:null;for (var i=0;i<l.length;i++)t.options[t.options.length]=new Option(f?f(l[i]):l[i],l[i]);t.value=v;}
dhtmlXGridObject.prototype.setSelectFilterLabel=function(ind,fun){if (!this._filter_tr)this._filter_tr=[];this._filter_tr[ind]=fun;}
dhtmlXGridObject.prototype._loadComboOptins=function(t,c){if (!t.combo)return;var l=this.collectValues(c);t.combo.clearAll();t.combo.render(false);var opts = [["","&nbsp;"]];for (var i=0;i<l.length;i++)opts.push([l[i],l[i]]);t.combo.addOption(opts);t.combo.render(true);}
dhtmlXGridObject.prototype.refreshFilters=function(){if(!this.filters)return;for (var i=0;i<this.filters.length;i++){switch(this.filters[i][0].tagName.toLowerCase()){case "input":
 break;case "select":
 this._loadSelectOptins.apply(this,this.filters[i]);break;case "div":
 this._loadComboOptins.apply(this,this.filters[i]);break;}
 }
}
dhtmlXGridObject.prototype._filters_ready=function(fl,code){this.attachEvent("onXLE",this.refreshFilters);this.attachEvent("onRowCreated",function(id,r){if (this._f_rowsBuffer)for (var i=0;i<this._f_rowsBuffer.length;i++)if (this._f_rowsBuffer[i].idd == id)return this._f_rowsBuffer[i]=r;})
 this.attachEvent("onClearAll",function(){this._f_rowsBuffer=null;if (!this.hdr.rows.length)this.filters=[];});if (window.dhtmlXCombo)this.attachEvent("onScroll",dhtmlXCombo.prototype.closeAll);this._filters_ready=function(){};}
dhtmlXGridObject.prototype._in_header_text_filter=function(t,i){t.innerHTML="<input type='text'>";t.onclick=t.onmousedown = function(e){(e||event).cancelBubble=true;return true;}
 t.onselectstart=function(){return (event.cancelBubble=true);}
 this.makeFilter(t.firstChild,i);}
dhtmlXGridObject.prototype._in_header_text_filter_inc=function(t,i){t.innerHTML="<input type='text'>";t.onclick=t.onmousedown = function(e){(e||event).cancelBubble=true;return true;}
 t.onselectstart=function(){return (event.cancelBubble=true);}
 this.makeFilter(t.firstChild,i);t.firstChild._filter=function(){if (t.firstChild.value=="")return "";return function(val){return (val.toString().toLowerCase().indexOf(t.firstChild.value.toLowerCase())==0);}
 }
 this._filters_ready();}
dhtmlXGridObject.prototype._in_header_select_filter=function(t,i){t.innerHTML="<select></select>";t.onclick=function(e){(e||event).cancelBubble=true;return false;}
 this.makeFilter(t.firstChild,i);}
dhtmlXGridObject.prototype._in_header_select_filter_strict=function(t,i){t.innerHTML="<select style='width:90%;font-size:8pt;font-family:Tahoma;'></select>";t.onclick=function(e){(e||event).cancelBubble=true;return false;}
 this.makeFilter(t.firstChild,i);var combos = this.combos;t.firstChild._filter=function(){var value = t.firstChild.value;if (!value)return "";if (combos[i])value = combos[i].keys[combos[i].values._dhx_find(value)];value = value.toLowerCase();return function(val){return (val.toString().toLowerCase()==value);};};this._filters_ready();}
dhtmlXGridObject.prototype._in_header_combo_filter=function(t,i){t.innerHTML="<div style='width:100%;padding-left:2px;overflow:hidden;' class='combo'></div>";t.onselectstart=function(){return (event.cancelBubble=true);}
 t.onclick=t.onmousedown=function(e){(e||event).cancelBubble=true;return true;}
 this.makeFilter(t.firstChild,i);}
dhtmlXGridObject.prototype._search_common=function(t, i){t.innerHTML="<input type='text' style='width:90%;'>";t.onclick= t.onmousedown = function(e){(e||event).cancelBubble=true;return true;}
 t.onselectstart=function(){return (event.cancelBubble=true);}
}
dhtmlXGridObject.prototype._in_header_text_search=function(t,i, strict){this._search_common(t, i);this.makeSearch(t.firstChild,i);}
dhtmlXGridObject.prototype._in_header_text_search_strict=function(t,i){this._search_common(t, i);this.makeSearch(t.firstChild,i, true);}
dhtmlXGridObject.prototype._in_header_numeric_filter=function(t,i){this._in_header_text_filter.call(this,t,i);t.firstChild._filter=function(){var v=this.value;var r;var op="==";var num=parseFloat(v.replace("=",""));var num2=null;if (v){if (v.indexOf("..")!=-1){v=v.split("..");num=parseFloat(v[0]);num2=parseFloat(v[1]);return function(v){if (v>=num && v<=num2)return true;return false;}
 }
 r=v.match(/>=|<=|>|</)
 if (r){op=r[0];num=parseFloat(v.replace(op,""));}
 return Function("v"," if (v "+op+" "+num+" )return true;return false;");}
 return "";};}
dhtmlXGridObject.prototype._in_header_master_checkbox=function(t,i,c){t.innerHTML=c[0]+"<input type='checkbox' />"+c[1];var self=this;t.getElementsByTagName("input")[0].onclick=function(e){self._build_m_order();var j=self._m_order?self._m_order[i]:i;var val=this.checked?1:0;self.forEachRowA(function(id){var c=this.cells(id,j);if (c.isCheckbox()) {c.setValue(val);c.cell.wasChanged = true;}
 this.callEvent("onEditCell",[1,id,j,val]);this.callEvent("onCheckbox", [id, j, val]);});(e||event).cancelBubble=true;}
}
dhtmlXGridObject.prototype._in_header_stat_total=function(t,i,c){var calck=function(){var summ=0;this._build_m_order();var ii = this._m_order?this._m_order[i]:i;for (var j=0;j<this.rowsBuffer.length;j++){var v=parseFloat(this._get_cell_value(this.rowsBuffer[j],ii));summ+=isNaN(v)?0:v;}
 
 return this._maskArr[ii]?this._aplNF(summ,ii):(Math.round(summ*100)/100);}
 this._stat_in_header(t,calck,i,c,c);}
dhtmlXGridObject.prototype._in_header_stat_multi_total=function(t,i,c){var cols=c[1].split(":");c[1]="";for(var k = 0;k < cols.length;k++){cols[k]=parseInt(cols[k]);}
 var calck=function(){var summ=0;for (var j=0;j<this.rowsBuffer.length;j++){var v = 1;for(var k = 0;k < cols.length;k++){v *= parseFloat(this._get_cell_value(this.rowsBuffer[j],cols[k]))
 }
 summ+=isNaN(v)?0:v;}
 return this._maskArr[i]?this._aplNF(summ,i):(Math.round(summ*100)/100);}
 var track=[];for(var i = 0;i < cols.length;i++){track[cols[i]]=true;}
 this._stat_in_header(t,calck,track,c,c);}
dhtmlXGridObject.prototype._in_header_stat_max=function(t,i,c){var calck=function(){var summ=-999999999;if (this.getRowsNum()==0) return "&nbsp;";for (var j=0;j<this.rowsBuffer.length;j++)summ=Math.max(summ,parseFloat(this._get_cell_value(this.rowsBuffer[j],i)));return this._maskArr[i]?this._aplNF(summ,i):summ;}
 this._stat_in_header(t,calck,i,c);}
dhtmlXGridObject.prototype._in_header_stat_min=function(t,i,c){var calck=function(){var summ=999999999;if (this.getRowsNum()==0) return "&nbsp;";for (var j=0;j<this.rowsBuffer.length;j++)summ=Math.min(summ,parseFloat(this._get_cell_value(this.rowsBuffer[j],i)));return this._maskArr[i]?this._aplNF(summ,i):summ;}
 this._stat_in_header(t,calck,i,c);}
dhtmlXGridObject.prototype._in_header_stat_average=function(t,i,c){var calck=function(){var summ=0;var count=0;if (this.getRowsNum()==0) return "&nbsp;";for (var j=0;j<this.rowsBuffer.length;j++){var v=parseFloat(this._get_cell_value(this.rowsBuffer[j],i));summ+=isNaN(v)?0:v;count++;}
 return this._maskArr[i]?this._aplNF(summ/count,i):(Math.round(summ/count*100)/100);}
 this._stat_in_header(t,calck,i,c);}
dhtmlXGridObject.prototype._in_header_stat_count=function(t,i,c){var calck=function(){return this.getRowsNum();}
 this._stat_in_header(t,calck,i,c);}
dhtmlXGridObject.prototype._stat_in_header=function(t,calck,i,c){var that=this;var f=function(){this.dma(true)
 t.innerHTML=(c[0]?c[0]:"")+calck.call(this)+(c[1]?c[1]:"");this.dma(false)
 this.callEvent("onStatReady",[])
 }
 if (!this._stat_events){this._stat_events=[];this.attachEvent("onClearAll",function(){if (!this.hdr.rows[1]){for (var i=0;i<this._stat_events.length;i++)for (var j=0;j < 4;j++)this.detachEvent(this._stat_events[i][j]);this._stat_events=[];}
 })
 }
 
 this._stat_events.push([
 this.attachEvent("onGridReconstructed",f),
 this.attachEvent("onXLE",f),
 this.attachEvent("onFilterEnd",f),
 this.attachEvent("onEditCell",function(stage,id,ind){if (stage==2 && ( ind==i || ( i && i[ind])) ) f.call(this);return true;})]);t.innerHTML="";}
 dhtmlXGridObject.prototype.enableDragAndDrop=function(mode){if (mode=="temporary_disabled"){this.dADTempOff=false;mode=true;}
 else
 this.dADTempOff=true;this.dragAndDropOff=convertStringToBoolean(mode);this._drag_validate=true;if (mode)this.objBox.ondragstart = function (e) {(e||event).cancelBubble = true;return false;}
 };dhtmlXGridObject.prototype.setDragBehavior=function(mode){this.dadmodec=this.dadmodefix=0;switch (mode) {case "child": this.dadmode=0;this._sbmod=false;break;case "sibling": this.dadmode=1;this._sbmod=false;break;case "sibling-next": this.dadmode=1;this._sbmod=true;break;case "complex": this.dadmode=2;this._sbmod=false;break;case "complex-next": this.dadmode=2;this._sbmod=true;break;}};dhtmlXGridObject.prototype.enableDragOrder=function(mode){this._dndorder=convertStringToBoolean(mode);};dhtmlXGridObject.prototype._checkParent=function(row,ids){var z=this._h2.get[row.idd].parent;if (!z.parent)return;for (var i=0;i<ids.length;i++)if (ids[i]==z.id)return true;return this._checkParent(this.rowsAr[z.id],ids);}
dhtmlXGridObject.prototype._createDragNode=function(htmlObject,e){this.editStop();if (window.dhtmlDragAndDrop.dragNode)return null;if (!this.dADTempOff)return null;htmlObject.parentObject=new Object();htmlObject.parentObject.treeNod=this;var text=this.callEvent("onBeforeDrag",[htmlObject.parentNode.idd,htmlObject._cellIndex]);if (!text)return null;var z=new Array();z[this.selMultiRows?z.length:0]=htmlObject.parentNode.idd;if (this.isTreeGrid()){for (var i=z.length-1;i>=0;i--)if (this._checkParent(this.rowsAr[z[i]],z)) z.splice(i,1);}
 

 var self=this;if (z.length && this._dndorder)z.sort(function(a,b){return (self.rowsAr[a].rowIndex>self.rowsAr[b].rowIndex?1:-1);});var el = this.getFirstParentOfType(_isIE?e.srcElement:e.target,"TD");if (el)this._dndExtra=el._cellIndex;this._dragged=new Array();for (var i=0;i<z.length;i++)if (this.rowsAr[z[i]]){this._dragged[this._dragged.length]=this.rowsAr[z[i]];this.rowsAr[z[i]].treeNod=this;}
 htmlObject.parentObject.parentNode=htmlObject.parentNode;var dragSpan=document.createElement('div');dragSpan.innerHTML=(text!==true?text:this.rowToDragElement(htmlObject.parentNode.idd));dragSpan.style.position="absolute";dragSpan.className="dragSpanDiv";return dragSpan;}
dhtmlXGridObject.prototype._createSdrgc=function(){this._sdrgc=document.createElement("DIV");this._sdrgc.innerHTML="&nbsp;";this._sdrgc.className="gridDragLine";this.objBox.appendChild(this._sdrgc);}
function dragContext(a,b,c,d,e,f,j,h,k,l){this.source=a||"grid";this.target=b||"grid";this.mode=c||"move";this.dropmode=d||"child";this.sid=e||0;this.tid=f;this.sobj=j||null;this.tobj=h||null;this.sExtra=k||null;this.tExtra=l||null;return this;}
dragContext.prototype.valid=function(){if (this.sobj!=this.tobj)return true;if (this.sid==this.tid)return false;if (this.target=="treeGrid"){var z=this.tid
 while (z = this.tobj.getParentId(z)){if (this.sid==z)return false;}
 }
 return true;}
dragContext.prototype.close=function(){this.sobj=null;this.tobj=null;}
dragContext.prototype.copy=function(){return new dragContext(this.source,this.target,this.mode,this.dropmode,this.sid,this.tid,this.sobj,this.tobj,this.sExtra,this.tExtra);}
dragContext.prototype.set=function(a,b){this[a]=b;return this;}
dragContext.prototype.uid=function(a,b){this.nid=this.sid;while (this.tobj.rowsAr[this.nid])this.nid=this.nid+((new Date()).valueOf());return this;}
dragContext.prototype.data=function(){if (this.sobj==this.tobj)return this.sobj._getRowArray(this.sobj.rowsAr[this.sid]);if (this.source=="tree")return this.tobj.treeToGridElement(this.sobj,this.sid,this.tid);else
 return this.tobj.gridToGrid(this.sid,this.sobj,this.tobj);}
dragContext.prototype.attrs=function(){if (this.source=="tree")return {};else
 return this.sobj.rowsAr[this.sid]._attrs;}
dragContext.prototype.childs=function(){if (this.source=="treeGrid")return this.sobj._h2.get[this.sid]._xml_await?this.sobj._h2.get[this.sid].has_kids:null;return null;}
dragContext.prototype.pid=function(){if (!this.tid)return 0;if (!this.tobj._h2)return 0;if (this.target=="treeGrid")if (this.dropmode=="child")return this.tid;else{var z=this.tobj.rowsAr[this.tid];var apid=this.tobj._h2.get[z.idd].parent.id;if ((this.alfa)&&(this.tobj._sbmod)&&(z.nextSibling)){var zpid=this.tobj._h2.get[z.nextSibling.idd].parent.id;if (zpid==this.tid)return this.tid;if (zpid!=apid)return zpid;}
 return apid;}
}
dragContext.prototype.ind=function(){if (this.tid==window.unknown)return this.tobj.rowsBuffer.length;if (this.target=="treeGrid"){if (this.dropmode=="child")this.tobj.openItem(this.tid);else
 this.tobj.openItem(this.tobj.getParentId(this.tid));}
 var ind=this.tobj.rowsBuffer._dhx_find(this.tobj.rowsAr[this.tid]);if ((this.alfa)&&(this.tobj._sbmod)&&(this.dropmode=="sibling")){var z=this.tobj.rowsAr[this.tid];if ((z.nextSibling)&&(this._h2.get[z.nextSibling.idd].parent.id==this.tid))
 return ind+1;}
 return (ind+1+((this.target=="treeGrid" && ind>=0 && this.tobj._h2.get[this.tobj.rowsBuffer[ind].idd].state=="minus")?this.tobj._getOpenLenght(this.tobj.rowsBuffer[ind].idd,0):0));}
dragContext.prototype.img=function(){if ((this.target!="grid")&&(this.sobj._h2))
 return this.sobj.getItemImage(this.sid);else return null;}
dragContext.prototype.slist=function(){var res=new Array();for (var i=0;i<this.sid.length;i++)res[res.length]=this.sid[i][(this.source=="tree")?"id":"idd"];return res.join(",");}
dhtmlXGridObject.prototype._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject,lastLanding){if (this._realfake)return this._fake._drag() 
 
 var z=(this.lastLanding)
 
 if (this._autoOpenTimer)window.clearTimeout(this._autoOpenTimer);var r1=targetHtmlObject.parentNode;var r2=sourceHtmlObject.parentObject;if (!r1.idd){r1.grid=this;this.dadmodefix=0;}
 var c=new dragContext(0,0,0,((r1.grid.dadmode==1 || r1.grid.dadmodec)?"sibling":"child"));if (r2 && r2.childNodes)c.set("source","tree").set("sobj",r2.treeNod).set("sid",c.sobj._dragged);else{if (!r2)return true;if (r2.treeNod.isTreeGrid && r2.treeNod.isTreeGrid())
 c.set("source","treeGrid");c.set("sobj",r2.treeNod).set("sid",c.sobj._dragged);}
 if (r1.grid.isTreeGrid())
 c.set("target","treeGrid");else
 c.set("dropmode","sibling");c.set("tobj",r1.grid).set("tid",r1.idd);var el = this.getFirstParentOfType(lastLanding,"TD")
 if (el)c.set("tExtra",el._cellIndex);if (el)c.set("sExtra",c.sobj._dndExtra);if (c.sobj.dpcpy)c.set("mode","copy");if (c.tobj._realfake)c.tobj=c.tobj._fake;if (c.sobj._realfake)c.sobj=c.sobj._fake;c.tobj._clearMove();if (r2 && r2.treeNod && r2.treeNod._nonTrivialRow)r2.treeNod._nonTrivialRow(this,c.tid,c.dropmode,r2);else {c.tobj.dragContext=c;if (!c.tobj.callEvent("onDrag",[c.slist(),c.tid,c.sobj,c.tobj,c.sExtra,c.tExtra])) return c.tobj.dragContext=null;var result=new Array();if (typeof(c.sid)=="object"){var nc=c.copy();for (var i=0;i<c.sid.length;i++){if (!nc.set("alfa",(!i)).set("sid",c.sid[i][(c.source=="tree"?"id":"idd")]).valid()) continue;nc.tobj._dragRoutine(nc);if (nc.target=="treeGrid" && nc.dropmode == "child")nc.tobj.openItem(nc.tid);result[result.length]=nc.nid;nc.set("dropmode","sibling").set("tid",nc.nid);}
 nc.close();}
 else
 c.tobj._dragRoutine(c);if (c.tobj.laterLink)c.tobj.laterLink();c.tobj.callEvent("onDrop",[c.slist(),c.tid,result.join(","),c.sobj,c.tobj,c.sExtra,c.tExtra]);}
 c.tobj.dragContext=null;c.close();}
dhtmlXGridObject.prototype._dragRoutine=function(c){if ((c.sobj==c.tobj)&&(c.source=="grid")&&(c.mode=="move")&&!this._fake){if (c.sobj._dndProblematic)return;var fr=c.sobj.rowsAr[c.sid];var bind=c.sobj.rowsCol._dhx_find(fr);c.sobj.rowsCol._dhx_removeAt(c.sobj.rowsCol._dhx_find(fr));c.sobj.rowsBuffer._dhx_removeAt(c.sobj.rowsBuffer._dhx_find(fr));c.sobj.rowsBuffer._dhx_insertAt(c.ind(),fr);if (c.tobj._fake){c.tobj._fake.rowsCol._dhx_removeAt(bind);var tr=c.tobj._fake.rowsAr[c.sid];tr.parentNode.removeChild(tr);}
 c.sobj._insertRowAt(fr,c.ind());c.nid=c.sid;c.sobj.callEvent("onGridReconstructed",[]);return;}
 var new_row;if (this._h2 && typeof c.tid !="undefined" && c.dropmode=="sibling" && (this._sbmod || c.tid)){if (c.alfa && this._sbmod && this._h2.get[c.tid].childs.length){this.openItem(c.tid)
 new_row=c.uid().tobj.addRowBefore(c.nid,c.data(),this._h2.get[c.tid].childs[0].id,c.img(),c.childs());}
 else
 new_row=c.uid().tobj.addRowAfter(c.nid,c.data(),c.tid,c.img(),c.childs());}
 else
 new_row=c.uid().tobj.addRow(c.nid,c.data(),c.ind(),c.pid(),c.img(),c.childs());new_row._attrs = c.attrs();if (c.source=="tree"){this.callEvent("onRowAdded",[c.nid]);var sn=c.sobj._globalIdStorageFind(c.sid);if (sn.childsCount){var nc=c.copy().set("tid",c.nid).set("dropmode",c.target=="grid"?"sibling":"child");for(var j=0;j<sn.childsCount;j++){c.tobj._dragRoutine(nc.set("sid",sn.childNodes[j].id));if (c.mode=="move")j--;}
 nc.close();}
 }
 else{c.tobj._copyUserData(c);this.callEvent("onRowAdded",[c.nid]);if ((c.source=="treeGrid")){if (c.sobj==c.tobj)new_row._xml=c.sobj.rowsAr[c.sid]._xml;var snc=c.sobj._h2.get[c.sid];if ((snc)&&(snc.childs.length)){var nc=c.copy().set("tid",c.nid);if(c.target=="grid")nc.set("dropmode","sibling");else {nc.tobj.openItem(c.tid);nc.set("dropmode","child");}
 var l=snc.childs.length;for(var j=0;j<l;j++){c.sobj.render_row_tree(null,snc.childs[j].id);c.tobj._dragRoutine(nc.set("sid",snc.childs[j].id));if (l!=snc.childs.length){j--;l=snc.childs.length;}
 }
 nc.close();}
 }
 }
 if (c.mode=="move"){c.sobj[(c.source=="tree")?"deleteItem":"deleteRow"](c.sid);if ((c.sobj==c.tobj)&&(!c.tobj.rowsAr[c.sid])) {c.tobj.changeRowId(c.nid,c.sid);c.nid=c.sid;}
 }
}
dhtmlXGridObject.prototype.gridToGrid = function(rowId,sgrid,tgrid){var z=new Array();for (var i=0;i<sgrid.hdr.rows[0].cells.length;i++)z[i]=sgrid.cells(rowId,i).getValue();return z;}
dhtmlXGridObject.prototype.checkParentLine=function(node,id){if ((!this._h2)||(!id)||(!node)) return false;if (node.id==id)return true;else return this.checkParentLine(node.parent,id);}
dhtmlXGridObject.prototype._dragIn=function(htmlObject,shtmlObject,x,y){if (!this.dADTempOff)return 0;var tree=this.isTreeGrid();var obj=shtmlObject.parentNode.idd?shtmlObject.parentNode:shtmlObject.parentObject;if (this._drag_validate){if(htmlObject.parentNode==shtmlObject.parentNode)return 0;if ((tree)&&(this==obj.grid)&&((this.checkParentLine(this._h2.get[htmlObject.parentNode.idd],shtmlObject.parentNode.idd))))
 return 0;}
 if (!this.callEvent("onDragIn",[obj.idd||obj.id,htmlObject.parentNode.idd,obj.grid||obj.treeNod,(htmlObject.grid||htmlObject.parentNode.grid)]))
 return this._setMove(htmlObject,x,y,true);this._setMove(htmlObject,x,y);if ((tree)&&(htmlObject.parentNode.expand!="")){this._autoOpenTimer=window.setTimeout(new callerFunction(this._autoOpenItem,this),1000);this._autoOpenId=htmlObject.parentNode.idd;}
 else
 if (this._autoOpenTimer)window.clearTimeout(this._autoOpenTimer);return htmlObject;}
dhtmlXGridObject.prototype._autoOpenItem=function(e,gridObject){gridObject.openItem(gridObject._autoOpenId);}
dhtmlXGridObject.prototype._dragOut=function(htmlObject){this._clearMove();var obj=htmlObject.parentNode.parentObject?htmlObject.parentObject.id:htmlObject.parentNode.idd;this.callEvent("onDragOut",[obj]);if (this._autoOpenTimer)window.clearTimeout(this._autoOpenTimer);}
dhtmlXGridObject.prototype._setMove=function(htmlObject,x,y,skip){if (!htmlObject.parentNode.idd)return;var a1=getAbsoluteTop(htmlObject);var a2=getAbsoluteTop(this.objBox);if ( (a1-a2)>(parseInt(this.objBox.offsetHeight)-50) )
 this.objBox.scrollTop=parseInt(this.objBox.scrollTop)+20;if ( (a1-a2+parseInt(this.objBox.scrollTop))<(parseInt(this.objBox.scrollTop)+30) )
 this.objBox.scrollTop=parseInt(this.objBox.scrollTop)-20;if (skip)return 0;if (this.dadmode==2){var z=y-a1+(document.body.scrollTop||document.documentElement.scrollTop)-2-htmlObject.offsetHeight/2;if ((Math.abs(z)-htmlObject.offsetHeight/6)>0)
 {this.dadmodec=1;if (z<0)this.dadmodefix=-1;else this.dadmodefix=1;}
 else this.dadmodec=0;}
 else
 this.dadmodec=this.dadmode;if (this.dadmodec){if (!this._sdrgc)this._createSdrgc();this._sdrgc.style.display="block";this._sdrgc.style.top=a1-a2+parseInt(this.objBox.scrollTop)+((this.dadmodefix>=0)?htmlObject.offsetHeight:0)+"px";}
 else{this._llSelD=htmlObject;if (htmlObject.parentNode.tagName=="TR")for (var i=0;i<htmlObject.parentNode.childNodes.length;i++){var z= htmlObject.parentNode.childNodes[i];z._bgCol=z.style.backgroundColor;z.style.backgroundColor="#FFCCCC";}
 }
}
dhtmlXGridObject.prototype._clearMove=function(){if (this._sdrgc)this._sdrgc.style.display="none";if ((this._llSelD)&&(this._llSelD.parentNode.tagName=="TR")){var coll = this._llSelD.parentNode.childNodes;for (var i=0;i<coll.length;i++)coll[i].style.backgroundColor=coll[i]._bgCol;}

 this._llSelD=null;}
dhtmlXGridObject.prototype.rowToDragElement=function(gridRowId){var out=this.cells(gridRowId,0).getValue();return out;}
dhtmlXGridObject.prototype._copyUserData = function(c){if(!c.tobj.UserData[c.nid] || c.tobj!=c.sobj)c.tobj.UserData[c.nid] = new Hashtable();else return;var z1 = c.sobj.UserData[c.sid];var z2 = c.tobj.UserData[c.nid];if (z1){z2.keys = z2.keys.concat(z1.keys);z2.values = z2.values.concat(z1.values);}
 }
dhtmlXGridObject.prototype.moveRow=function(rowId,mode,targetId,targetGrid){switch(mode){case "row_sibling":
 this.moveRowTo(rowId,targetId,"move","sibling",this,targetGrid);break;case "up":
 this.moveRowUp(rowId);break;case "down":
 this.moveRowDown(rowId);break;}
}
dhtmlXGridObject.prototype.loadCSVFile = function(path,afterCall){this.load(path,afterCall,"csv")
}
dhtmlXGridObject.prototype.enableCSVAutoID = function(mode){this._csvAID=convertStringToBoolean(mode);}
dhtmlXGridObject.prototype.enableCSVHeader = function(mode){this._csvHdr=convertStringToBoolean(mode);}
dhtmlXGridObject.prototype.setCSVDelimiter = function(str){this.csv.cell=str;}
dhtmlXGridObject.prototype._csvAID = true;dhtmlXGridObject.prototype.loadCSVString = function(str){this.parse(str,"csv")
}
dhtmlXGridObject.prototype.serializeToCSV = function(textmode){this.editStop()
 if (this._mathSerialization)this._agetm="getMathValue";else if (this._strictText || textmode)this._agetm="getTitle";else this._agetm="getValue";var out=[];if (this._csvHdr){for (var j=1;j < this.hdr.rows.length;j++){var a=[];for (var i=0;i<this._cCount;i++)if ((!this._srClmn)||(this._srClmn[i]))
 a.push(this.getColumnLabel(i,j-1));out.push(this.csvParser.str(a,this.csv.cell, this.csv.row));}
 }
 
 
 var i=0;var leni=this.rowsBuffer.length;for(i;i<leni;i++){var temp=this._serializeRowToCVS(null,i) 
 if (temp!="")out.push(temp);}
 return this.csvParser.block(out,this.csv.row);}
dhtmlXGridObject.prototype._serializeRowToCVS = function(r,i,start,end){var out = new Array();if (!r){r=this.render_row(i)
 if (this._fake && !this._fake.rowsAr[r.idd])this._fake.render_row(i);}
 

 if (!this._csvAID)out[out.length]=r.idd;start = start||0;end = end||this._cCount;var changeFl=false;var ind=start;while (r.childNodes[start]._cellIndex>ind && start)start--;for(var jj=start;ind<end;jj++){if (!r.childNodes[jj])break;var real_ind=r.childNodes[jj]._cellIndex;if ((!this._srClmn)||(this._srClmn[real_ind])){var cvx=r.childNodes[jj];var zx=this.cells(r.idd,real_ind);while (ind!=real_ind){ind++;out.push("")
 if (ind>=end)break;}
 if (ind>=end)break;ind++;if (zx.cell)zxVal=zx[this._agetm]();else zxVal="";if ((this._chAttr)&&(zx.wasChanged()))
 changeFl=true;out[out.length]=((zxVal===null)?"":zxVal)

 if ( this._ecspn && cvx.colSpan && cvx.colSpan >1 ){cvx=cvx.colSpan-1;for (var u=0;u<cvx;u++){out[out.length] = "";ind++;}
 }
 }else ind++;}
 if ((this._onlChAttr)&&(!changeFl)) return "";return this.csvParser.str(out,this.csv.cell, this.csv.row);}
dhtmlXGridObject.prototype.toClipBoard=function(val){if (window.clipboardData)window.clipboardData.setData("Text",val);else
 (new Clipboard()).copy(val);}
dhtmlXGridObject.prototype.fromClipBoard=function(){if (window.clipboardData)return window.clipboardData.getData("Text");else
 return (new Clipboard()).paste();}
dhtmlXGridObject.prototype.cellToClipboard = function(rowId,cellInd){if ((!rowId)||(!cellInd)){if (!this.selectedRows[0])return;rowId=this.selectedRows[0].idd;cellInd=this.cell._cellIndex;}
 
 var ed=this.cells(rowId,cellInd);this.toClipBoard(((ed.getLabel?ed.getLabel():ed.getValue())||"").toString());}
dhtmlXGridObject.prototype.updateCellFromClipboard = function(rowId,cellInd){if ((!rowId)||(!cellInd)){if (!this.selectedRows[0])return;rowId=this.selectedRows[0].idd;cellInd=this.cell._cellIndex;}
 var ed=this.cells(rowId,cellInd);ed[ed.setImage?"setLabel":"setValue"](this.fromClipBoard());}
dhtmlXGridObject.prototype.rowToClipboard = function(rowId){var out="";if (this._mathSerialization)this._agetm="getMathValue";else if (this._strictText)this._agetm="getTitle";else 
 this._agetm="getValue";if (rowId)out=this._serializeRowToCVS(this.getRowById(rowId));else {var data = [];for (var i=0;i<this.selectedRows.length;i++){data[data.length] = this._serializeRowToCVS(this.selectedRows[i]);out = this.csvParser.block(data, this.csv.row);}
 }
 this.toClipBoard(out);}
dhtmlXGridObject.prototype.updateRowFromClipboard = function(rowId){var csv=this.fromClipBoard();if (!csv)return;if (rowId)var r=this.getRowById(rowId);else
 var r=this.selectedRows[0];if (!r)return;var parser = this.csvParser;csv=parser.unblock(csv,this.csv.cell, this.csv.row)[0];if (!this._csvAID)csv.splice(0,1);for (var i=0;i<csv.length;i++){var ed=this.cells3(r,i);ed[ed.setImage?"setLabel":"setValue"](csv[i]);}
}
dhtmlXGridObject.prototype.csvParser={block:function(data,row){return data.join(row);},
 unblock:function(str,cell,row){var data = (str||"").split(row);for (var i=0;i < data.length;i++)data[i]=(data[i]||"").split(cell);var last = data.length-1;if (data[last].length == 1 && data[last][0]=="")data.splice(last,1);return data;},
 str:function(data,cell,row){return data.join(cell);}
};dhtmlXGridObject.prototype.csvExtParser={_quote:RegExp('"',"g"),
 _quote_esc:RegExp("\\\\\"","g"),
 block:function(data,row){return data.join(row);},
 unblock:function(str,cell,row){var out = [[]];var ind = 0;if (!str)return out;var quote_start = /^[ ]*"/;var quote_end = /"[ ]*$/;var row_exp = new RegExp(".*"+row+".*$");var data = str.split(cell);for (var i=0;i<data.length;i++){if (data[i].match(quote_start)){var buff = data[i].replace(quote_start, "");while (!data[i].match(quote_end)) {i++;buff+=data[i];}
 out[ind].push(buff.replace(quote_end, "").replace(this._quote_esc,'"'));}else if (data[i].match(row_exp)){var row_pos = data[i].indexOf(row);out[ind].push(data[i].substr(0, row_pos));ind++;out[ind] = [];data[i]=data[i].substr(row_pos+1);i--;}else {if (data[i] || i!=data.length-1)out[ind].push(data[i]);}
 }
 var last = out.length-1;if (last>0 && !out[last].length)out.splice(last,1);return out;},
 str:function(data,cell,row){for (var i=0;i < data.length;i++)data[i] = '"'+data[i].replace(this._quote, "\\\"")+'"';return data.join(cell);}
};dhtmlXGridObject.prototype.addRowFromClipboard = function(){var csv=this.fromClipBoard();if (!csv)return;var z=this.csvParser.unblock(csv, this.csv.cell, this.csv.row);for (var i=0;i<z.length;i++)if (z[i]){csv=z[i];if (!csv.length)continue;if (this._csvAID)this.addRow(this.getRowsNum()+2,csv);else{if (this.rowsAr[csv[0]])csv[0]=this.uid();this.addRow(csv[0],csv.slice(1));}
 }
}
dhtmlXGridObject.prototype.gridToClipboard = function(){this.toClipBoard(this.serializeToCSV());}
dhtmlXGridObject.prototype.gridFromClipboard = function(){var csv=this.fromClipBoard();if (!csv)return;this.loadCSVString(csv);}
dhtmlXGridObject.prototype.getXLS = function(path){if (!this.xslform){this.xslform=document.createElement("FORM");this.xslform.action=(path||"")+"xls.php";this.xslform.method="post";this.xslform.target=(_isIE?"_blank":"");document.body.appendChild(this.xslform);var i1=document.createElement("INPUT");i1.type="hidden";i1.name="csv";this.xslform.appendChild(i1);var i2=document.createElement("INPUT");i2.type="hidden";i2.name="csv_header";this.xslform.appendChild(i2);}
 var cvs = this.serializeToCSV();this.xslform.childNodes[0].value = cvs;var cvs_header = [];var l = this._cCount;for (var i=0;i<l;i++){cvs_header.push(this.getHeaderCol(i));}
 cvs_header = cvs_header.join(',');this.xslform.childNodes[1].value = cvs_header;this.xslform.submit();}
dhtmlXGridObject.prototype.printView = function(before,after){var html="<style>TD {font-family:Arial;text-align:center;padding-left:2px;padding-right:2px;}\n td.filter input, td.filter select {display:none;}\n </style>";var st_hr=null;if (this._fake){st_hr=[].concat(this._hrrar);for (var i=0;i<this._fake._cCount;i++)this._hrrar[i]=null;}
 html+="<base href='"+document.location.href+"'></base>";if (!this.parentGrid)html+=(before||"");html += '<table width="100%" border="2px" cellpadding="0" cellspacing="0">';var row_length = Math.max(this.rowsBuffer.length,this.rowsCol.length);var col_length = this._cCount;var width = this._printWidth();html += '<tr class="header_row_1">';for (var i=0;i<col_length;i++){if (this._hrrar && this._hrrar[i])continue;var hcell=this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes?this.hdr.rows[1]._childIndexes[parseInt(i)]:i];var colspan=(hcell.colSpan||1);var rowspan=(hcell.rowSpan||1);for (var j=1;j<colspan;j++)width[i]+=width[j];html += '<td rowspan="'+rowspan+'" width="'+width[i]+'%" style="background-color:lightgrey;" colspan="'+colspan+'">'+this.getHeaderCol(i)+'</td>';i+=colspan-1;}
 html += '</tr>';for (var i=2;i<this.hdr.rows.length;i++){if (_isIE){html+="<tr style='background-color:lightgrey' class='header_row_"+i+"'>";var cells=this.hdr.rows[i].childNodes;for (var j=0;j < cells.length;j++)if (!this._hrrar || !this._hrrar[cells[j]._cellIndex]){html+=cells[j].outerHTML;}
 html+="</tr>";}
 else
 html+="<tr class='header_row_"+i+"' style='background-color:lightgrey'>"+(this._fake?this._fake.hdr.rows[i].innerHTML:"")+this.hdr.rows[i].innerHTML+"</tr>";}
 for (var i=0;i<row_length;i++){html += '<tr>';if (this.rowsCol[i] && this.rowsCol[i]._cntr){html+=this.rowsCol[i].innerHTML.replace(/<img[^>]*>/gi,"")+'</tr>';continue;}
 if (this.rowsCol[i] && this.rowsCol[i].style.display=="none")continue;var row_id
 if (this.rowsCol[i])row_id=this.rowsCol[i].idd;else if (this.rowsBuffer[i])row_id=this.rowsBuffer[i].idd;else continue;for (var j=0;j<col_length;j++){if (this._hrrar && this._hrrar[j])continue;if(this.rowsAr[row_id] && this.rowsAr[row_id].tagName=="TR"){var c=this.cells(row_id, j);if (c._setState)var value="";else if (c.getContent)value = c.getContent();else if (c.getImage || c.combo)var value=c.cell.innerHTML;else var value = c.getValue();}else 
 var value=this._get_cell_value(this.rowsBuffer[i],j);var color = this.columnColor[j]?'background-color:'+this.columnColor[j]+';':'';var align = this.cellAlign[j]?'text-align:'+this.cellAlign[j]+';':'';var cspan = c.getAttribute("colspan");html += '<td style="'+color+align+'" '+(cspan?'colSpan="'+cspan+'"':'')+'>'+(value===""?"&nbsp;":value)+'</td>';if (cspan)j+=cspan-1;}
 html += '</tr>';if (this.rowsCol[i] && this.rowsCol[i]._expanded){var sub=this.cells4(this.rowsCol[i]._expanded.ctrl);if (sub.getSubGrid)html += '<tr><td colspan="'+col_length+'">'+sub.getSubGrid().printView()+'</td></tr>';else
 html += '<tr><td colspan="'+col_length+'">'+this.rowsCol[i]._expanded.innerHTML+'</td></tr>';}
 }
 if (this.ftr)for (var i=1;i<this.ftr.childNodes[0].rows.length;i++)html+="<tr style='background-color:lightgrey'>"+((this._fake)?this._fake.ftr.childNodes[0].rows[i].innerHTML:"")+this.ftr.childNodes[0].rows[i].innerHTML+"</tr>";html += '</table>';if (this.parentGrid)return html;html+=(after||"");var d = window.open('', '_blank');d.document.write(html);d.document.write("<script>window.onerror=function(){return true;}</script>");d.document.close();if (this._fake){this._hrrar=st_hr;}
}
dhtmlXGridObject.prototype._printWidth=function(){var width = [];var total_width = 0;for (var i=0;i<this._cCount;i++){var w = this.getColWidth(i);width.push(w);total_width += w;}
 var percent_width = [];var total_percent_width = 0;for (var i=0;i<width.length;i++){var p = Math.floor((width[i]/total_width)*100);total_percent_width += p;percent_width.push(p);}
 percent_width[percent_width.length-1] += 100-total_percent_width;return percent_width;}
dhtmlXGridObject.prototype.loadObject = function(obj){}
dhtmlXGridObject.prototype.loadJSONFile = function(path){}
dhtmlXGridObject.prototype.serializeToObject = function(){}
dhtmlXGridObject.prototype.serializeToJSON = function(){}
if (!window.clipboardData)window.clipboardData={_make:function(){var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);if (!clip)return null;var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);if (!trans)return null;trans.addDataFlavor('text/unicode');var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);this._p=[clip,trans,str];return true;},
 setData:function(type,text){try{netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');}catch(e){dhtmlxError.throwError("Clipboard","Access to clipboard denied",[type,text]);return "";}
 if (!this._make()) return false;this._p[2].data=text;this._p[1].setTransferData("text/unicode",this._p[2],text.length*2);var clipid=Components.interfaces.nsIClipboard;this._p[0].setData(this._p[1],null,clipid.kGlobalClipboard);},
 getData:function(type){try{netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');}catch(e){dhtmlxError.throwError("Clipboard","Access to clipboard denied",[type]);return "";}
 if (!this._make()) return false;this._p[0].getData(this._p[1],this._p[0].kGlobalClipboard);var strLength = new Object();var str = new Object();try{this._p[1].getTransferData("text/unicode",str,strLength);}catch(e){return "";}
 if (str)str = str.value.QueryInterface(Components.interfaces.nsISupportsString);if (str)return str.data.substring(0,strLength.value / 2);return "";}
}
dhtmlXGridObject.prototype.enableBlockSelection = function(mode)
{if (typeof this._bs_mode == "undefined"){var self = this;this.obj.onmousedown = function(e) {if (self._bs_mode)self._OnSelectionStart((e||event),this);return true;}
 this._CSVRowDelimiter = this.csv.row;this.attachEvent("onResize", function() {self._HideSelection();return true;});this.attachEvent("onGridReconstructed", function() {self._HideSelection();return true;});this.attachEvent("onFilterEnd",this._HideSelection);}
 if (mode===false){this._bs_mode=false;return this._HideSelection();}else this._bs_mode=true;}
dhtmlXGridObject.prototype.forceLabelSelection = function(mode)
{this._strictText = convertStringToBoolean(mode)
}
dhtmlXGridObject.prototype.disableBlockSelection = function()
{this.obj.onmousedown = null;}
 
dhtmlXGridObject.prototype._OnSelectionStart = function(event, obj)
{var self = this;if (event.button == 2)return;var src = event.srcElement || event.target;if (this.editor){if (src.tagName && (src.tagName=="INPUT" || src.tagName=="TEXTAREA")) return;this.editStop();}
 
 if (!self.isActive)self.setActive(true);var pos = this.getPosition(this.obj);var x = event.clientX - pos[0] + (document.body.scrollLeft||(document.documentElement?document.documentElement.scrollLeft:0));var y = event.clientY - pos[1] + (document.body.scrollTop||(document.documentElement?document.documentElement.scrollTop:0));this._CreateSelection(x-4, y-4);if (src == this._selectionObj){this._HideSelection();this._startSelectionCell = null;}else {while (src.tagName.toLowerCase()!= 'td')
 src = src.parentNode;this._startSelectionCell = src;}
 
 if (this._startSelectionCell){if (!this.callEvent("onBeforeBlockSelected",[this._startSelectionCell.parentNode.idd, this._startSelectionCell._cellIndex]))
 return this._startSelectionCell = null;}
 
 
 this.obj.onmousedown = null;this.obj[_isIE?"onmouseleave":"onmouseout"] = function(e){if (self._blsTimer)window.clearTimeout(self._blsTimer);};this.obj.onmmold=this.obj.onmousemove;this._init_pos=[x,y];this._selectionObj.onmousemove = this.obj.onmousemove = function(e) {e = e||event;e.returnValue = false;self._OnSelectionMove(e);}
 
 
 this._oldDMP=document.body.onmouseup;document.body.onmouseup = function(e) {e = e||event;self._OnSelectionStop(e, this);return true;}
 this.callEvent("onBeforeBlockSelection",[]);document.body.onselectstart = function(){return false};}
dhtmlXGridObject.prototype._getCellByPos = function(x,y){x=x;if (this._fake)x+=this._fake.entBox.offsetWidth;y=y;var _x=0;for (var i=0;i < this.obj.rows.length;i++){y-=this.obj.rows[i].offsetHeight;if (y<=0){_x=this.obj.rows[i];break;}
 }
 if (!_x || !_x.idd)return null;for (var i=0;i < this._cCount;i++){x-=this.getColWidth(i);if (x<=0){while(true){if (_x._childIndexes && _x._childIndexes[i+1]==_x._childIndexes[i])_x=_x.previousSibling;else {return this.cells(_x.idd,i).cell;}
 
 }
 }
 }
 return null;}
dhtmlXGridObject.prototype._OnSelectionMove = function(event)
{var self=this;this._ShowSelection();var pos = this.getPosition(this.obj);var X = event.clientX - pos[0] + (document.body.scrollLeft||(document.documentElement?document.documentElement.scrollLeft:0));var Y = event.clientY - pos[1] + (document.body.scrollTop||(document.documentElement?document.documentElement.scrollTop:0));if ((Math.abs(this._init_pos[0]-X)<5) && (Math.abs(this._init_pos[1]-Y)<5)) return this._HideSelection();var temp = this._endSelectionCell;if(this._startSelectionCell==null)this._endSelectionCell = this._startSelectionCell = this.getFirstParentOfType(event.srcElement || event.target,"TD");else
 if (event.srcElement || event.target){if ((event.srcElement || event.target).className == "dhtmlxGrid_selection")
 this._endSelectionCell=(this._getCellByPos(X,Y)||this._endSelectionCell);else {var t = this.getFirstParentOfType(event.srcElement || event.target,"TD");if (t.parentNode.idd)this._endSelectionCell = t;}
 }
 
 if (this._endSelectionCell){if (!this.callEvent("onBeforeBlockSelected",[this._endSelectionCell.parentNode.idd, this._endSelectionCell._cellIndex]))
 this._endSelectionCell = temp;}
 
 
 var BottomRightX = this.objBox.scrollLeft + this.objBox.clientWidth;var BottomRightY = this.objBox.scrollTop + this.objBox.clientHeight;var TopLeftX = this.objBox.scrollLeft;var TopLeftY = this.objBox.scrollTop;var nextCall=false;if (this._blsTimer)window.clearTimeout(this._blsTimer);if (X+20 >= BottomRightX){this.objBox.scrollLeft = this.objBox.scrollLeft+20;nextCall=true;}else if (X-20 < TopLeftX){this.objBox.scrollLeft = this.objBox.scrollLeft-20;nextCall=true;}
 if (Y+20 >= BottomRightY && !this._realfake){this.objBox.scrollTop = this.objBox.scrollTop+20;nextCall=true;}else if (Y-20 < TopLeftY && !this._realfake){this.objBox.scrollTop = this.objBox.scrollTop-20;nextCall=true;}
 this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._endSelectionCell);if (nextCall){var a=event.clientX;var b=event.clientY;this._blsTimer=window.setTimeout(function(){self._OnSelectionMove({clientX:a,clientY:b})},100);}
 
}
dhtmlXGridObject.prototype._OnSelectionStop = function(event)
{var self = this;if (this._blsTimer)window.clearTimeout(this._blsTimer);this.obj.onmousedown = function(e) {if (self._bs_mode)self._OnSelectionStart((e||event), this);return true;}
 this.obj.onmousemove = this.obj.onmmold||null;this._selectionObj.onmousemove = null;document.body.onmouseup = this._oldDMP||null;if ( parseInt( this._selectionObj.style.width )< 2 && parseInt( this._selectionObj.style.height ) < 2) {this._HideSelection();}else {var src = this.getFirstParentOfType(event.srcElement || event.target,"TD");if ((!src)|| (!src.parentNode.idd)){src=this._endSelectionCell;}
 if (!src)return this._HideSelection();while (src.tagName.toLowerCase()!= 'td')
 src = src.parentNode;this._stopSelectionCell = src;this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._stopSelectionCell);this.callEvent("onBlockSelected",[]);}
 document.body.onselectstart = function(){};}
dhtmlXGridObject.prototype._RedrawSelectionPos = function(LeftTop, RightBottom)
{var pos = {};pos.LeftTopCol = LeftTop._cellIndex;pos.LeftTopRow = this.getRowIndex( LeftTop.parentNode.idd );pos.RightBottomCol = RightBottom._cellIndex;pos.RightBottomRow = this.getRowIndex( RightBottom.parentNode.idd );var LeftTop_width = LeftTop.offsetWidth;var LeftTop_height = LeftTop.offsetHeight;LeftTop = this.getPosition(LeftTop, this.obj);var RightBottom_width = RightBottom.offsetWidth;var RightBottom_height = RightBottom.offsetHeight;RightBottom = this.getPosition(RightBottom, this.obj);if (LeftTop[0] < RightBottom[0]){var Left = LeftTop[0];var Right = RightBottom[0] + RightBottom_width;}else {var foo = pos.RightBottomCol;pos.RightBottomCol = pos.LeftTopCol;pos.LeftTopCol = foo;var Left = RightBottom[0];var Right = LeftTop[0] + LeftTop_width;}
 if (LeftTop[1] < RightBottom[1]){var Top = LeftTop[1];var Bottom = RightBottom[1] + RightBottom_height;}else {var foo = pos.RightBottomRow;pos.RightBottomRow = pos.LeftTopRow;pos.LeftTopRow = foo;var Top = RightBottom[1];var Bottom = LeftTop[1] + LeftTop_height;}
 var Width = Right - Left;var Height = Bottom - Top;this._selectionObj.style.left = Left + 'px';this._selectionObj.style.top = Top + 'px';this._selectionObj.style.width = Width + 'px';this._selectionObj.style.height = Height + 'px';return pos;}
dhtmlXGridObject.prototype._CreateSelection = function(x, y)
{if (this._selectionObj == null){var div = document.createElement('div');div.style.position = 'absolute';div.style.display = 'none';div.className = 'dhtmlxGrid_selection';this._selectionObj = div;this._selectionObj.onmousedown = function(e){e=e||event;if (e.button==2 || (_isMacOS&&e.ctrlKey))
 return this.parentNode.grid.callEvent("onBlockRightClick", ["BLOCK",e]);}
 this._selectionObj.oncontextmenu=function(e){(e||event).cancelBubble=true;return false;}
 this.objBox.appendChild(this._selectionObj);}
 
 this._selectionObj.style.width = '0px';this._selectionObj.style.height = '0px';this._selectionObj.style.left = x + 'px';this._selectionObj.style.top = y + 'px';this._selectionObj.startX = x;this._selectionObj.startY = y;}
dhtmlXGridObject.prototype._ShowSelection = function()
{if (this._selectionObj)this._selectionObj.style.display = '';}
dhtmlXGridObject.prototype._HideSelection = function()
{if (this._selectionObj)this._selectionObj.style.display = 'none';this._selectionArea = null;}
dhtmlXGridObject.prototype.copyBlockToClipboard = function()
{if ( this._selectionArea != null ){var serialized = new Array();if (this._mathSerialization)this._agetm="getMathValue";else if (this._strictText)this._agetm="getTitle";else this._agetm="getValue";for (var i=this._selectionArea.LeftTopRow;i<=this._selectionArea.RightBottomRow;i++){var data = this._serializeRowToCVS(this.rowsBuffer[i], null, this._selectionArea.LeftTopCol, this._selectionArea.RightBottomCol+1);if (!this._csvAID)serialized[serialized.length] = data.substr( data.indexOf( this.csv.cell ) + 1 );else
 serialized[serialized.length] = data;}
 serialized = serialized.join(this._CSVRowDelimiter);this.toClipBoard(serialized);}
}
dhtmlXGridObject.prototype.pasteBlockFromClipboard = function()
{var serialized = this.fromClipBoard();if (this._selectionArea != null){var startRow = this._selectionArea.LeftTopRow;var startCol = this._selectionArea.LeftTopCol;}else if (this.cell != null && !this.editor){var startRow = this.getRowIndex( this.cell.parentNode.idd );var startCol = this.cell._cellIndex;}else {return false;}
 serialized = this.csvParser.unblock(serialized, this.csv.cell, this.csv.row);var endRow = startRow+serialized.length;var endCol = startCol+serialized[0].length;if (endCol > this._cCount)endCol = this._cCount;var k = 0;for (var i=startRow;i<endRow;i++){var row = this.render_row(i);if (row==-1)continue;var l = 0;for (var j=startCol;j<endCol;j++){var ed = this.cells3(row, j);if (ed.isDisabled()) {l++;continue;}
 if (this._onEditUndoRedo)this._onEditUndoRedo(2, row.idd, j, serialized[ k ][ l ], ed.getValue());if (ed.combo){var comboVa = ed.combo.values;for(var n=0;n<comboVa.length;n++)if (serialized[ k ][ l ] == comboVa[n]){ed.setValue( ed.combo.keys[ n ]);comboVa=null;break;}
 if (comboVa!=null && ed.editable)ed.setValue( serialized[ k ][ l++ ] );else l++;}else
 ed[ ed.setImage ? "setLabel" : "setValue" ]( serialized[ k ][ l++ ] );ed.cell.wasChanged=true;}
 this.callEvent("onRowPaste",[row.idd])
 k++;}
}
dhtmlXGridObject.prototype.getSelectedBlock = function() {if (this._selectionArea)return this._selectionArea;else if (this.getSelectedRowId()!== null){return {LeftTopRow: this.getSelectedRowId(),
 LeftTopCol: this.getSelectedCellIndex(),
 RightBottomRow: this.getSelectedRowId(),
 RightBottomCol: this.getSelectedCellIndex()
 };}else
 return null;};dhtmlXGridObject.prototype.enableSmartRendering=function(mode,buffer,reserved){if (arguments.length>2){if (buffer && !this.rowsBuffer[buffer-1])this.rowsBuffer[buffer-1]=0;buffer=reserved;}
 this._srnd=convertStringToBoolean(mode);this._srdh=this._srdh||20;this._dpref=buffer||0;};dhtmlXGridObject.prototype.enablePreRendering=function(buffer){this._srnd_pr=parseInt(buffer||50);};dhtmlXGridObject.prototype.forceFullLoading=function(buffer, callback){for (var i=0;i<this.rowsBuffer.length;i++)if (!this.rowsBuffer[i]){var usedbuffer = buffer || (this.rowsBuffer.length-i);if (this.callEvent("onDynXLS",[i,usedbuffer])){var self=this;this.load(this.xmlFileUrl+getUrlSymbol(this.xmlFileUrl)+"posStart="+i+"&count="+usedbuffer, function(){window.setTimeout(function(){self.forceFullLoading(buffer, callback);},100);}, this._data_type);}
 return;}
 if (callback)callback.call(this);};dhtmlXGridObject.prototype.setAwaitedRowHeight = function(height) {this._srdh=parseInt(height);};dhtmlXGridObject.prototype._get_view_size=function(){return Math.floor(parseInt(this.entBox.offsetHeight)/this._srdh)+2;};dhtmlXGridObject.prototype._add_filler=function(pos,len,fil,rsflag){if (!len)return null;var id="__filler__";var row=this._prepareRow(id);row.firstChild.style.width="1px";for (var i=1;i<row.childNodes.length;i++)row.childNodes[i].style.display='none';row.firstChild.style.height=len*this._srdh+"px";fil=fil||this.rowsCol[pos];if (fil && fil.nextSibling)fil.parentNode.insertBefore(row,fil.nextSibling);else
 if (_isKHTML)this.obj.appendChild(row);else
 this.obj.rows[0].parentNode.appendChild(row);this.callEvent("onAddFiller",[pos,len,row,fil,rsflag]);return [pos,len,row];};dhtmlXGridObject.prototype._update_srnd_view=function(){var min=Math.floor(this.objBox.scrollTop/this._srdh);var max=min+this._get_view_size();if (this.multiLine){var pxHeight = this.objBox.scrollTop;min = 0;while(pxHeight > 0){pxHeight-=this.rowsCol[min]?this.rowsCol[min].offsetHeight:this._srdh;min++;}
 
 max=min+this._get_view_size();if (min>0)min--;}
 max+=(this._srnd_pr||0);if (max>this.rowsBuffer.length)max=this.rowsBuffer.length;for (var j=min;j<max;j++){if (!this.rowsCol[j]){var res=this._add_from_buffer(j);if (res==-1){if (this.xmlFileUrl){if (this._dpref && this.rowsBuffer[max-1]){var rows_count = this._dpref?this._dpref:(max-j)
 var start_pos = Math.max(0, max - this._dpref);this._current_load=[start_pos, max-start_pos];}else 
 this._current_load=[j,(this._dpref?this._dpref:(max-j))];if (this.callEvent("onDynXLS",this._current_load))
 this.load(this.xmlFileUrl+getUrlSymbol(this.xmlFileUrl)+"posStart="+this._current_load[0]+"&count="+this._current_load[1], this._data_type);}
 return;}else {if (this._tgle){this._updateLine(this._h2.get[this.rowsBuffer[j].idd],this.rowsBuffer[j]);this._updateParentLine(this._h2.get[this.rowsBuffer[j].idd],this.rowsBuffer[j]);}
 if (j && j==(this._realfake?this._fake:this)["_r_select"]){this.selectCell(j, this.cell?this.cell._cellIndex:0, true);}
 }
 }
 }
 if (this._fake && !this._realfake && this.multiLine)this._fake.objBox.scrollTop = this.objBox.scrollTop;}
dhtmlXGridObject.prototype._add_from_buffer=function(ind){var row=this.render_row(ind);if (row==-1)return -1;if (row._attrs["selected"] || row._attrs["select"]){this.selectRow(row,false,true);row._attrs["selected"]=row._attrs["select"]=null;}
 
 if (!this._cssSP){if (this._cssEven && ind%2 == 0 )row.className=this._cssEven+((row.className.indexOf("rowselected") != -1)?" rowselected ":" ")+(row._css||"");else if (this._cssUnEven && ind%2 == 1 )row.className=this._cssUnEven+((row.className.indexOf("rowselected") != -1)?" rowselected ":" ")+(row._css||"");}else if (this._h2){var x=this._h2.get[row.idd];row.className+=" "+((x.level%2)?(this._cssUnEven+" "+this._cssUnEven):(this._cssEven+" "+this._cssEven))+"_"+x.level+(this.rowsAr[x.id]._css||"");}
 

 
 for (var i=0;i<this._fillers.length;i++){var f=this._fillers[i];if (f && f[0]<=ind && (f[0]+f[1])>ind ){var pos=ind-f[0];if (pos==0){this._insert_before(ind,row,f[2]);this._update_fillers(i,-1,1);}else if (pos == f[1]-1){this._insert_after(ind,row,f[2]);this._update_fillers(i,-1,0);}else {this._fillers.push(this._add_filler(ind+1,f[1]-pos-1,f[2],1));this._insert_after(ind,row,f[2]);this._update_fillers(i,-f[1]+pos,0);}
 return;}
 }
}
dhtmlXGridObject.prototype._update_fillers=function(ind,right,left){var f=this._fillers[ind];f[1]=f[1]+right;f[0]=f[0]+left;if (!f[1]){this.callEvent("onRemoveFiller",[f[2]]);f[2].parentNode.removeChild(f[2]);this._fillers.splice(ind,1);}else {f[2].firstChild.style.height=parseFloat(f[2].firstChild.style.height)+right*this._srdh+"px";this.callEvent("onUpdateFiller",[f[2]]);}
}
dhtmlXGridObject.prototype._insert_before=function(ind,row,fil){fil.parentNode.insertBefore(row,fil);this.rowsCol[ind]=row;this.callEvent("onRowInserted",[row,null,fil,"before"]);}
dhtmlXGridObject.prototype._insert_after=function(ind,row,fil){if (fil.nextSibling)fil.parentNode.insertBefore(row,fil.nextSibling);else
 fil.parentNode.appendChild(row);this.rowsCol[ind]=row;this.callEvent("onRowInserted",[row,null,fil,"after"]);}
function dhtmlXGridFromTable(obj,init){if(typeof(obj)!='object')
 obj = document.getElementById(obj);var w=document.createElement("DIV");w.setAttribute("width",obj.getAttribute("gridWidth")||(obj.offsetWidth?(obj.offsetWidth+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["width"]:(obj.currentStyle?obj.currentStyle["width"]:0)));w.setAttribute("height",obj.getAttribute("gridHeight")||(obj.offsetHeight?(obj.offsetHeight+"px"):0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["height"]:(obj.currentStyle?obj.currentStyle["height"]:0)));w.className = obj.className;obj.className="";if (obj.id)w.id = obj.id;var mr=obj;var drag=obj.getAttribute("dragAndDrop");mr.parentNode.insertBefore(w,mr);var f=mr.getAttribute("name")||("name_"+(new Date()).valueOf());var windowf=new dhtmlXGridObject(w);window[f]=windowf;var acs=mr.getAttribute("onbeforeinit");var acs2=mr.getAttribute("oninit");if (acs)eval(acs);windowf.setImagePath(windowf.imgURL||(mr.getAttribute("imgpath")|| mr.getAttribute("image_path") ||""));var skin = mr.getAttribute("skin");if (skin)windowf.setSkin(skin);if (init)init(windowf);var hrow=mr.rows[0];var za="";var zb="";var zc="";var zd="";var ze="";for (var i=0;i<hrow.cells.length;i++){za+=(za?",":"")+hrow.cells[i].innerHTML;var width=hrow.cells[i].getAttribute("width")||hrow.cells[i].offsetWidth||(window.getComputedStyle?window.getComputedStyle(hrow.cells[i],null)["width"]:(hrow.cells[i].currentStyle?hrow.cells[i].currentStyle["width"]:0));zb+=(zb?",":"")+(width=="*"?width:parseInt(width));zc+=(zc?",":"")+(hrow.cells[i].getAttribute("align")||"left");zd+=(zd?",":"")+(hrow.cells[i].getAttribute("type")||"ed");ze+=(ze?",":"")+(hrow.cells[i].getAttribute("sort")||"str");var f_a=hrow.cells[i].getAttribute("format");if (f_a)if(hrow.cells[i].getAttribute("type").toLowerCase().indexOf("calendar")!=-1) 
 windowf._dtmask=f_a;else
 windowf.setNumberFormat(f_a,i);}
 windowf.setHeader(za);windowf.setInitWidths(zb)
 windowf.setColAlign(zc)
 windowf.setColTypes(zd);windowf.setColSorting(ze);if (obj.getAttribute("gridHeight")=="auto")
 windowf.enableAutoHeigth(true);if (obj.getAttribute("multiline")) windowf.enableMultiline(true);var lmn=mr.getAttribute("lightnavigation");if (lmn)windowf.enableLightMouseNavigation(lmn);var evr=mr.getAttribute("evenrow");var uevr=mr.getAttribute("unevenrow");if (evr||uevr)windowf.enableAlterCss(evr,uevr);if (drag)windowf.enableDragAndDrop(true);windowf.init();if (obj.getAttribute("split")) windowf.splitAt(obj.getAttribute("split"));windowf._process_inner_html(mr,1);if (acs2)eval(acs2);if (obj.parentNode && obj.parentNode.removeChild)obj.parentNode.removeChild(obj);return windowf;}
dhtmlXGridObject.prototype._process_html=function(xml){if (xml.tagName && xml.tagName == "TABLE")return this._process_inner_html(xml,0);var temp=document.createElement("DIV");temp.innerHTML=xml.xmlDoc.responseText;var mr = temp.getElementsByTagName("TABLE")[0];this._process_inner_html(mr,0);}
dhtmlXGridObject.prototype._process_inner_html=function(mr,start){var n_l=mr.rows.length;for (var j=start;j<n_l;j++){var id=mr.rows[j].getAttribute("id")||j;this.rowsBuffer.push({idd:id, data:mr.rows[j], _parser: this._process_html_row, _locator:this._get_html_data });}
 this.render_dataset();this.setSizes();}
 
dhtmlXGridObject.prototype._process_html_row=function(r,xml){var cellsCol = xml.getElementsByTagName('TD');var strAr = [];r._attrs=this._xml_attrs(xml);for(var j=0;j<cellsCol.length;j++){var cellVal=cellsCol[j];var exc=cellVal.getAttribute("type");if (r.childNodes[j]){if (exc)r.childNodes[j]._cellType=exc;r.childNodes[j]._attrs=this._xml_attrs(cellsCol[j]);}
 
 if (cellVal.firstChild)strAr.push(cellVal.innerHTML);else strAr.push("");if (cellVal.colSpan>1){r.childNodes[j]._attrs["colspan"]=cellVal.colSpan;for (var k=1;k<cellVal.colSpan;k++){strAr.push("")
 }
 }
 
}
 for(j<cellsCol.length;j<r.childNodes.length;j++)r.childNodes[j]._attrs={};this._fillRow(r,(this._c_order?this._swapColumns(strAr):strAr));return r;}
dhtmlXGridObject.prototype._get_html_data=function(data,ind){data=data.firstChild;while (true){if (!data)return "";if (data.tagName=="TD")ind--;if (ind<0)break;data=data.nextSibling;}
 return (data.firstChild?data.firstChild.data:"");}
dhtmlxEvent(window,"load",function(){var z=document.getElementsByTagName("table");for (var a=0;a<z.length;a++)if (z[a].className=="dhtmlxGrid"){dhtmlXGridFromTable(z[a]);}
});dhtmlxValidation=function(){};dhtmlxValidation.prototype={trackInput:function(el,rule,callback_error,callback_correct){dhtmlxEvent(el,"keyup",function(e){if (dhtmlxValidation._timer){window.clearTimeout(dhtmlxValidation._timer);dhtmlxValidation._timer = null;}
 dhtmlxValidation._timer = window.setTimeout(function(){if (!dhtmlxValidation.checkInput(el,rule)){if(!callback_error || callback_error(el,el.value,rule))
 el.className+=" dhtmlx_live_validation_error";}else {el.className=el.className.replace(/[ ]*dhtmlx_live_validation_error/g,"");if (callback_correct)callback_correct(el,el.value,rule);}
 
 },250);});},
 checkInput:function(input,rule){return this.checkValue(input.value,rule);},
 checkValue:function(value,rule){if (typeof rule=="string")rule = rule.split(",");var final_res=true;for (var i=0;i<rule.length;i++){if (!this["is"+rule[i]])alert("Incorrect validation rule: "+rule[i]);else
 final_res=final_res&&this["is"+rule[i]](value);;}
 return final_res;},
 isEmpty: function(value) {return value == '';},
 isNotEmpty: function(value) {return !value == '';},
 isValidBoolean: function(value) {return !!value.toString().match(/^(0|1|true|false)$/);},
 isValidEmail: function(value) {return !!value.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,4})$)/i);},
 isValidInteger: function(value) {return !!value.toString().match(/(^-?\d+$)/);},
 isValidNumeric: function(value) {return !!value.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/);},
 isValidAplhaNumeric: function(value) {return !!value.toString().match(/^[_\-a-z0-9]+$/gi);},
 
 isValidDatetime: function(value) {var dt = value.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);return dt && !!(dt[1]<=9999 && dt[2]<=12 && dt[3]<=31 && dt[4]<=59 && dt[5]<=59 && dt[6]<=59) || false;},
 
 isValidDate: function(value) {var d = value.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);return d && !!(d[1]<=9999 && d[2]<=12 && d[3]<=31) || false;},
 
 isValidTime: function(value) {var t = value.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);return t && !!(t[1]<=24 && t[2]<=59 && t[3]<=59) || false;},
 
 isValidIPv4: function(value) {var ip = value.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);return ip && !!(ip[1]<=255 && ip[2]<=255 && ip[3]<=255 && ip[4]<=255) || false;},
 isValidCurrency: function(value) {return value.toString().match(/^\$?\s?\d+?[\.,\,]?\d+?\s?\$?$/) && true || false;},
 
 isValidSSN: function(value) {return value.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false;},
 
 isValidSIN: function(value) {return value.toString().match(/^\d{9}$/) && true || false;}
};dhtmlxValidation=new dhtmlxValidation();dhtmlXGridObject.prototype.enableValidation=function(mode,live){mode=convertStringToBoolean(mode);if (mode){this._validators={data:[] };}else
 this._validators=false;if (arguments.length>1)this._validators._live=live;if (!this._validators._event)this._validators._event=this.attachEvent("onEditCell",this.validationEvent);};dhtmlXGridObject.prototype.setColValidators=function(vals){if (!this._validators)this.enableValidation(true);if (typeof vals == "string")vals=vals.split(this.delim);this._validators.data=vals;};dhtmlXGridObject.prototype.validationEvent=function(stage,id,ind,newval,oldval){var v=this._validators;if (!v)return true;var rule=(v.data[ind]||this.cells(id,ind).getAttribute("validate"))||"";if (stage==1 && rule){var ed = this.editor||(this._fake||{}).editor;if (!ed)return true;ed.cell.className=ed.cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");if (v._live){var grid=this;dhtmlxValidation.trackInput(ed.getInput(),rule,function(element,value,rule){return grid.callEvent("onLiveValidationError",[id,ind,value,element,rule]);},function(element,value,rule){return grid.callEvent("onLiveValidationCorrect",[id,ind,value,element,rule]);});}
 }
 if (stage==2)this.validateCell(id,ind,rule,newval);return true;};dhtmlXGridObject.prototype.validateCell=function(id,ind,rule,value){rule=rule||(this._validators.data[ind]||this.cells(id,ind).getAttribute("validate"));value=value||this.cells(id,ind).getValue();if (!rule)return;var cell = this.cells(id,ind).cell;var result = true;if (typeof rule == "string")rule = rule.split(this.delim);for (var i=0;i < rule.length;i++){if (!dhtmlxValidation.checkValue(value,rule[i])){if (this.callEvent("onValidationError",[id,ind,value,rule[i]]))
 cell.className+=" dhtmlx_validation_error";result = false;}
 }
 if (result){this.callEvent("onValidationCorrect",[id,ind,value,rule]);cell.className=cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");}
 return result;};function eXcell_dhxCalendar(cell){if (cell){this.cell = cell;this.grid = this.cell.parentNode.grid;if (!this.grid._grid_calendarA){var cal=this.grid._grid_calendarA=new dhtmlxCalendarObject();this.grid.callEvent("onDhxCalendarCreated",[cal]);var sgrid=this.grid;cal.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){sgrid.editStop()},1);return true;});var zFunc=function(e){(e||event).cancelBubble=true;}
 dhtmlxEvent(cal.base,"click",zFunc);cal=null;}
 }
}
eXcell_dhxCalendar.prototype = new eXcell;eXcell_dhxCalendar.prototype.edit = function(){var arPos = this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false, false);this.grid._grid_calendarA.setPosition(arPos[0],arPos[1]+this.cell.offsetHeight);this.grid._grid_calendarA._last_operation_calendar=false;this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var t=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat((this.grid._dtmask||"%d/%m/%Y"));this.grid._grid_calendarA.setDate(this.val||(new Date()));this.grid._grid_calendarA.draw=t;}
 eXcell_dhxCalendar.prototype.getDate = function(){if (this.cell.val)return this.cell.val;return null;}
 
 eXcell_dhxCalendar.prototype.getValue = function(){if (this.cell._clearCell)return "";if (this.grid._dtmask_inc && this.cell.val)return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString();return this.cell.innerHTML.toString()._dhx_trim()
 }
 eXcell_dhxCalendar.prototype.detach = function(){if (!this.grid._grid_calendarA)return;this.grid._grid_calendarA.hide();if (this.cell._cediton)this.cell._cediton=false;else return;if (this.grid._grid_calendarA._last_operation_calendar){var z1=this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"));var z2=this.grid._grid_calendarA.getDate();this.cell.val=new Date(z2);this.setCValue(z1,z2);this.cell._clearCell=!z1;var t=this.val;this.val=this._val;return (this.cell.val.valueOf()!=t);}
 return false;}
 
 eXcell_dhxCalendar.prototype.setValue = function(val){if (val && typeof val == "object"){this.cell.val=val;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),val).toString(),this.cell.val);return;}
 
 
 if(!val || val.toString()._dhx_trim()==""){val="&nbsp";this.cell._clearCell=true;this.cell.val="";}
 else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y"),val.toString(),null,true));if (this.grid._dtmask_inc)val = this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),this.cell.val);}
 if ((this.cell.val=="NaN")||(this.cell.val=="Invalid Date")){this.cell._clearCell=true;this.cell.val=new Date();this.setCValue("&nbsp;",0);}
 else
 this.setCValue((val||"").toString(),this.cell.val);}
function eXcell_dhxCalendarA(cell){if (cell){this.cell = cell;this.grid = this.cell.parentNode.grid;if (!this.grid._grid_calendarA){var cal = this.grid._grid_calendarA = new dhtmlxCalendarObject();this.grid.callEvent("onDhxCalendarCreated",[cal]);var sgrid=this.grid;cal.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){sgrid.editStop()},1);return true;});var zFunc=function(e){(e||event).cancelBubble=true;}
 dhtmlxEvent(cal.base,"click",zFunc);}
 }
}
eXcell_dhxCalendarA.prototype = new eXcell;eXcell_dhxCalendarA.prototype.edit = function(){var arPos = this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false, false);this.grid._grid_calendarA.setPosition(arPos[0]*1+this.cell.offsetWidth,arPos[1]*1);this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid._grid_calendarA._last_operation_calendar=false;this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var t=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat((this.grid._dtmask||"%d/%m/%Y"));this.grid._grid_calendarA.setDate(this.val);this.grid._grid_calendarA.draw=t;this.grid._grid_calendarA.draw();this.cell.atag=((!this.grid.multiLine)&&(_isKHTML||_isMacOS||_isFF))?"INPUT":"TEXTAREA";this.obj = document.createElement(this.cell.atag);this.obj.style.height = (this.cell.offsetHeight-(_isIE?4:2))+"px";this.obj.className="dhx_combo_edit";this.obj.wrap = "soft";this.obj.style.textAlign = this.cell.align;this.obj.onclick = function(e){(e||event).cancelBubble = true}
 this.obj.onmousedown = function(e){(e||event).cancelBubble = true}
 this.obj.value = this.getValue();this.cell.innerHTML = "";this.cell.appendChild(this.obj);if (_isFF){this.obj.style.overflow="visible";if ((this.grid.multiLine)&&(this.obj.offsetHeight>=18)&&(this.obj.offsetHeight<40)){this.obj.style.height="36px";this.obj.style.overflow="scroll";}
 }
 this.obj.onselectstart=function(e){if (!e)e=event;e.cancelBubble=true;return true;};this.obj.focus()
 this.obj.focus()
 
 }
 
 eXcell_dhxCalendarA.prototype.getDate = function(){if (this.cell.val)return this.cell.val;return null;}
 
 eXcell_dhxCalendarA.prototype.getValue = function(){if (this.cell._clearCell)return "";if (this.grid._dtmask_inc && this.cell.val)return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString();return this.cell.innerHTML.toString()._dhx_trim()
 }
 eXcell_dhxCalendarA.prototype.detach = function(){if (!this.grid._grid_calendarA)return;this.grid._grid_calendarA.hide();if (this.cell._cediton)this.cell._cediton=false;else return;if (this.grid._grid_calendarA._last_operation_calendar){this.grid._grid_calendarA._last_operation_calendar=false;var z1=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y");var z2=this.grid._grid_calendarA.getDate();this.cell.val=new Date(z2);this.setCValue(z1,z2);this.cell._clearCell = !z1;var t=this.val;this.val=this._val;return (this.cell.val.valueOf()!=(t|"").valueOf());}
 this.setValue(this.obj.value);var t=this.val;this.val=this._val;return (this.cell.val.valueOf()!=(t||"").valueOf());}
eXcell_dhxCalendarA.prototype.setValue = function(val){if (val && typeof val == "object"){this.cell.val=val;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),val).toString(),this.cell.val);return;}
 
 if(!val || val.toString()._dhx_trim()==""){val="&nbsp";this.cell._clearCell=true;this.cell.val="";}
 else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y"),val.toString(),null,true));if (this.grid._dtmask_inc)val = this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask||"%d/%m/%Y"),this.cell.val);}
 
 if ((this.cell.val=="NaN")||(this.cell.val=="Invalid Date")){this.cell.val=new Date();this.cell._clearCell=true;this.setCValue("&nbsp;",0);}
 else
 this.setCValue((val||"").toString(),this.cell.val);}
function eXcell_cntr(cell){this.cell = cell;this.grid = this.cell.parentNode.grid;if (!this.grid._ex_cntr_ready && !this._realfake){this.grid._ex_cntr_ready=true;if (this.grid._h2)this.grid.attachEvent("onOpenEn",function(id){this.resetCounter(cell._cellIndex);});this.grid.attachEvent("onBeforeSorting",function(){var that=this;window.setTimeout(function(){if (!that.resetCounter)return;if (that._fake && !that._realfake && cell._cellIndex<that._fake._cCount)that._fake.resetCounter(cell._cellIndex);else
 that.resetCounter(cell._cellIndex);},1)
 return true;});}
 
 

 this.edit = function(){}
 this.getValue = function(){return this.cell.innerHTML;}
 this.setValue = function(val){this.cell.style.paddingRight = "2px";var cell=this.cell;window.setTimeout(function(){if (!cell.parentNode)return;var val=cell.parentNode.rowIndex;if (cell.parentNode.grid.currentPage || val<0 || cell.parentNode.grid._srnd)val=cell.parentNode.grid.rowsBuffer._dhx_find(cell.parentNode)+1;if (val<=0)return;cell.innerHTML = val;if (cell.parentNode.grid._fake && cell._cellIndex<cell.parentNode.grid._fake._cCount && cell.parentNode.grid._fake.rowsAr[cell.parentNode.idd])cell.parentNode.grid._fake.cells(cell.parentNode.idd,cell._cellIndex).setCValue(val);cell=null;},100);}
}
dhtmlXGridObject.prototype.resetCounter=function(ind){if (this._fake && !this._realfake && ind < this._fake._cCount)this._fake.resetCounter(ind,this.currentPage);var i=arguments[0]||0;if (this.currentPage)i=(this.currentPage-1)*this.rowsBufferOutSize;for (i=0;i<this.rowsBuffer.length;i++)if (this.rowsBuffer[i] && this.rowsBuffer[i].tagName == "TR" && this.rowsAr[this.rowsBuffer[i].idd])this.rowsAr[this.rowsBuffer[i].idd].childNodes[ind].innerHTML=i+1;}
eXcell_cntr.prototype = new eXcell;function eXcell_link(cell){this.cell = cell;this.grid = this.cell.parentNode.grid;this.isDisabled=function(){return true;}
 this.edit = function(){}
 this.getValue = function(){if(this.cell.firstChild.getAttribute){var target = this.cell.firstChild.getAttribute("target")
 return this.cell.firstChild.innerHTML+"^"+this.cell.firstChild.getAttribute("href")+(target?("^"+target):"");}
 else
 return "";}
 this.setValue = function(val){if((typeof(val)!="number") && (!val || val.toString()._dhx_trim()=="")){this.setCValue("&nbsp;",valsAr);return (this.cell._clearCell=true);}
 var valsAr = val.split("^");if(valsAr.length==1)valsAr[1] = "";else{if(valsAr.length>1){valsAr[1] = "href='"+valsAr[1]+"'";if(valsAr.length==3)valsAr[1]+= " target='"+valsAr[2]+"'";else
 valsAr[1]+= " target='_blank'";}
 }
 this.setCValue("<a "+valsAr[1]+" onclick='(_isIE?event:arguments[0]).cancelBubble = true;'>"+valsAr[0]+"</a>",valsAr);}
}
eXcell_link.prototype = new eXcell;eXcell_link.prototype.getTitle=function(){var z=this.cell.firstChild;return ((z&&z.tagName)?z.getAttribute("href"):"");}
eXcell_link.prototype.getContent=function(){var z=this.cell.firstChild;return ((z&&z.tagName)?z.innerHTML:"");}
function dhtmlXLayoutPanel(){}
function dhtmlXLayoutObject(base, view, skin) {if (!window.dhtmlXContainer){alert(this.i18n.dhxcontalert);return;}
 
 
 
 
 
 var that = this;this._autodetectSkin = function() {var t = document.createElement("DIV");t.className = "dhxlayout_skin_detect";if (document.body.childNodes.length > 0)document.body.insertBefore(t, document.body.childNodes[0]);else document.body.appendChild(t);var w = t.offsetWidth;document.body.removeChild(t);t = null;if (w == 199)return "dhx_skyblue";if (w == 299)return "dhx_blue";if (w == 399)return "dhx_black";if (w == 499)return "dhx_web";if (w == 599)return "dhx_terrace";return "dhx_skyblue";}
 
 this.skin = (skin != null ? skin : (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : this._autodetectSkin()));this.setSkin = function(skin) {if (!this.skinParams[skin])return;this.skin = skin;this._CPanelHeight = this.skinParams[this.skin]["cpanel_height"];this._collapsedW = this.skinParams[this.skin]["cpanel_collapsed_width"];this._collapsedH = this.skinParams[this.skin]["cpanel_collapsed_height"];this.tpl.className = "dhtmlxLayoutPolyContainer_"+this.skin+(this._r?" dhxlayout_rtl":"");this.sizer.className = "dhxLayout_Sizer_"+this.skin;if (this.dhxWins)this.dhxWins.setSkin(this.skin);for (var a in this.polyObj)this.polyObj[a].skin = this.skin;this.base.skin = this.skin;this._fixIcons();this.setSizes();}
 
 this._isIPad = (navigator.userAgent.search(/iPad/gi)>=0);this._dblClickTM = 600;this._mTop = 0;this._mBottom = 0;if (typeof(base)== "string") {base = document.getElementById(base);}
 
 
 if ((base._isWindow == true || base._isCell)&& !this.base) {if (base._isCell && base.attachLayout)return base.attachLayout(view, skin);if (base.isWindow)return base.attachLayout(view, skin);this.base = base;}
 
 if (base == document.body && !this.base){document.body.style.overflow = "hidden";}
 
 if ((typeof(base)== "object" || base == document.body) && !this.base) {var contObj = document.createElement("DIV");contObj.className = "dhxcont_global_layout_area";base.appendChild(contObj);base._isLayout = true;this.cont = new dhtmlXContainer(base);this.cont.setContent(contObj);if (base == document.body){if (this.skin == "dhx_skyblue"||this.skin == "dhx_blue"){this.cont.obj._offsetTop = 2;this.cont.obj._offsetLeft = 2;this.cont.obj._offsetHeight = -4;this.cont.obj._offsetWidth = -4;}
 if (this.skin == "dhx_web"){this.cont.obj._offsetTop = 9;this.cont.obj._offsetLeft = 9;this.cont.obj._offsetHeight = -18;this.cont.obj._offsetWidth = -18;}
 if (this.skin == "dhx_terrace"){this.cont.obj._offsetTop = 14;this.cont.obj._offsetLeft = 14;this.cont.obj._offsetHeight = -28;this.cont.obj._offsetWidth = -28;}
 document.body.className += " dhxlayout_fullscreened";}
 
 base.adjustContent(base, this._mTop, null, null, this._mBottom);this.base = document.createElement("DIV");this.base.style.overflow = "hidden";this.base.style.position = "absolute";this.base.style.left = "0px";this.base.style.top = "0px";this.base.style.width = contObj.childNodes[0].style.width;this.base.style.height = contObj.childNodes[0].style.height;contObj.childNodes[0].appendChild(this.base);if (base == document.body){this._tmTime = null;this._lw = null;this._doOnResizeStart = function() {window.clearTimeout(this._tmTime);this._tmTime = window.setTimeout(function(){that._doOnResizeEnd();},200);}
 this._doOnResizeEnd = function() {this.setSizes(false);}
 
 if (_isIE){window.attachEvent("onresize", that._doOnResizeStart);}else {window.addEventListener("resize", that._doOnResizeStart, false);}
 
 }
 
 base._doOnAttachToolbar = function(){if (that != null && typeof(that.setSizes)== "function") that.setSizes();}
 }
 
 this.items = new Array();this.cells = function(id) {if (this.polyObj[id] != null){return this.polyObj[id];}
 return null;}
 
 this.getIdByIndex = function(ind) {if (ind < 0)return null;if (ind >= this.items.length)return null;return this.items[ind]._idd;}
 
 this.getIndexById = function(id) {if (this.cells(id)!= null) return this.cells(id).getIndex();return null;}
 
 
 
 this.imagePath = dhtmlx.image_path||"codebase/imgs/";this.setImagePath = function(path) {this.imagePath = path;}
 
 
 
 this.polyObj = {};this.sepHor = new Array();this.sepVer = new Array();this._layoutView = (view!=null?String(view).toUpperCase():"3E");this._minWidth = 40;this._minHeight = 40;this._CPanelBtnsWidth = 32;this.skinParams = {"dhx_black" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 34, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
 "dhx_blue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 34, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
 "dhx_skyblue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 26, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
 
 "dhx_web" : {"hor_sep_height": 9, "ver_sep_width": 9, "cpanel_height": 27, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18, "cell_pading_max": 1, "cell_pading_min": 0},
 "dhx_terrace" : {"hor_sep_height": 14, "ver_sep_width": 14, "cpanel_height": 37, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18, "cell_pading_max": 1, "cell_pading_min": 0}
 
 };this._CPanelHeight = this.skinParams[this.skin]["cpanel_height"];this._collapsedW = this.skinParams[this.skin]["cpanel_collapsed_width"];this._collapsedH = this.skinParams[this.skin]["cpanel_collapsed_height"];this.tpl = document.createElement("TABLE");this.tpl.dir = "ltr";this.tpl.className = "dhtmlxLayoutPolyContainer_"+this.skin;this.tpl.cellSpacing = 0;this.tpl.cellPadding = 0;var bd = document.createElement("TBODY");this.tpl.appendChild(bd);this.tpl.border = 0;this.tplSizes = {};this._effects = {"collapse": false, "resize": false, "highlight": true };this.sizer = document.createElement("DIV");this.sizer.className = "dhxLayout_Sizer_"+this.skin;this.sizer.style.display = "none";document.body.appendChild(this.sizer);this._attachSizer = function(obj) {that.sizer.style.left = getAbsoluteLeft(obj)+"px";that.sizer.style.top = getAbsoluteTop(obj)+"px";that.sizer.style.width = obj.offsetWidth+"px";that.sizer.style.height = obj.offsetHeight+"px";if (that._sizerML != null)that.sizer.style.marginLeft = that._sizerML+"px";if (that._sizerMT != null)that.sizer.style.marginTop = that._sizerMT+"px";that.sizer.style.display = "";that.sizer.className = "dhxLayout_Sizer_"+that.skin;if (obj._dir != null){that.sizer.className += " "+(obj._dir=="hor"?"dhxCursorNResize":"dhxCursorWResize");}
 }
 
 
 this.listViews = function() {var views = new Array();for (var a in this.tplData){views[views.length] = a;}
 return views;}
 this._init = function() {this.obj = document.createElement("DIV");this.obj.className = "dhtmlxLayoutObject";this.base.appendChild(this.obj);this.obj.appendChild(this.tpl);this.w = this.obj.offsetWidth;this.h = this.obj.offsetHeight;this._xmlLoader.loadXMLString(this.tplData[this._layoutView]!=null?this.tplData[this._layoutView]:this.tplData["3E"]);this._initWindows();}
 
 this._autoHor = new Array();this._autoVer = new Array();this._dimension = new Array(320, 200);this._rowsRatio = 100;this._colsRatio = 100;this._xmlParser = function() {var tableDataH = new Array();var tableDataV = new Array();var tableSeps = {};var root = this.getXMLTopNode("layout");for (var q=0;q<root.childNodes.length;q++){if (root.childNodes[q].tagName == "row"){var row = root.childNodes[q];var tr = document.createElement("TR");that.tpl.childNodes[0].appendChild(tr);for (var w=0;w<row.childNodes.length;w++){if (row.childNodes[w].tagName == "cell"){var cell = row.childNodes[w];var td = document.createElement("TD");td._dir = "null";if (cell.getAttribute("obj")!= null) {var obj = cell.getAttribute("obj");var wh = String(cell.getAttribute("wh")).split(",");var f = isNaN(wh[0]);var tdW = (isNaN(wh[0])?parseInt(that.polyObj[wh[0]].style.width):0);for (var q1=0;q1<tableDataH.length;q1++){for (var w1=0;w1<tableDataH[q1].length;w1++){if (tableDataH[q1][w1] == obj){if (!f){f = true;var mw = that.base.offsetWidth - tableSeps[obj][0]*that.skinParams[that.skin]["ver_sep_width"];for (var r=0;r<tableDataH[q1].length;r++){if (!isNaN(tableDataH[q1][r])) {mw -= tableDataH[q1][r];wh[0] -= 1;}}
 tdW = Math.ceil(mw/wh[0]);}
 tableDataH[q1][w1] = tdW;}
 }
 }
 td.style.width = tdW+"px";var f = isNaN(wh[1]);var tdH = (isNaN(wh[1])?parseInt(that.polyObj[wh[1]].style.height):0);for (var q1=0;q1<tableDataV.length;q1++){for (var w1=0;w1<tableDataV[q1].length;w1++){if (tableDataV[q1][w1] == obj){if (!f){f = true;var mh = that.base.offsetHeight - tableSeps[obj][1]*that.skinParams[that.skin]["hor_sep_height"];for (var r=0;r<tableDataV.length;r++){if (!isNaN(tableDataV[r][w1])) {mh -= tableDataV[r][w1];wh[1] -= 1;}}
 tdH = Math.ceil(mh/wh[1]);}
 tableDataV[q1][w1] = tdH;}
 }
 }
 td.style.height = tdH+"px";td.className = "dhtmlxLayoutSinglePoly";td.innerHTML = "";td._minW = (cell.getAttribute("minWidth") != null ? Number(cell.getAttribute("minWidth")):that._minWidth);td._minH = (cell.getAttribute("minHeight") != null ? Number(cell.getAttribute("minHeight")):that._minHeight);td._initCPanel = (cell.getAttribute("cpanel") != null ? (cell.getAttribute("cpanel")=="false"?false:true):true);td._resize = cell.getAttribute("resize");var rd = String(cell.getAttribute("neighbors")).split(";");for (var e=0;e<rd.length;e++){var p = String(rd[e]).split(",");if (p.length > 1){rd[e] = p;}}
 td._rowData = rd;that.polyObj[obj] = td;}
 if (cell.getAttribute("sep")!= null) {var sep = cell.getAttribute("sep");if (sep == "hor"){td.className = "dhtmlxLayoutPolySplitterHor";td._dir = "hor";var top = cell.getAttribute("top").split(";");for (var e=0;e<top.length;e++){var p = String(top[e]).split(",");if (p.length > 1){top[e] = p;}}
 td._top = top;var bottom = cell.getAttribute("bottom").split(";");for (var e=0;e<bottom.length;e++){var p = String(bottom[e]).split(",");if (p.length > 1){bottom[e] = p;}}
 td._bottom = bottom;that.sepHor[that.sepHor.length] = td;}else {td.className = "dhtmlxLayoutPolySplitterVer";td._dir = "ver";var left = cell.getAttribute("left").split(";");for (var e=0;e<left.length;e++){var p = String(left[e]).split(",");if (p.length > 1){left[e] = p;}}
 td._left = left;var right = cell.getAttribute("right").split(";");for (var e=0;e<right.length;e++){var p = String(right[e]).split(",");if (p.length > 1){right[e] = p;}}
 td._right = right;that.sepVer[that.sepVer.length] = td;}
 td._dblClick = cell.getAttribute("dblclick");td._isSep = true;td.innerHTML = '<div style="height:2px;overflow:hidden;">&nbsp;</div>';}
 if (cell.getAttribute("colspan")!= null) {td.colSpan = cell.getAttribute("colspan");}
 if (cell.getAttribute("rowspan")!= null) {td.rowSpan = cell.getAttribute("rowspan");}
 tr.appendChild(td);}
 }
 }
 
 if (root.childNodes[q].tagName == "autosize"){that._autoHor = (root.childNodes[q].getAttribute("hor")).split(";");that._autoVer = (root.childNodes[q].getAttribute("ver")).split(";");that._totalCols = root.childNodes[q].getAttribute("cols");that._totalRows = root.childNodes[q].getAttribute("rows");that._dimension[0] = that._totalCols * that._colsRatio;that._dimension[1] = that._totalRows * that._rowsRatio;}
 
 if (root.childNodes[q].tagName == "table"){var data = root.childNodes[q].getAttribute("data");var r = String(data).split(";");for (var q1=0;q1<r.length;q1++){tableDataH[q1] = new Array();tableDataV[q1] = new Array();var c = String(r[q1]).split(",");for (var w1=0;w1<c.length;w1++){tableDataH[q1][w1] = c[w1];tableDataV[q1][w1] = c[w1];if (tableSeps[c[w1]] == null){tableSeps[c[w1]] = new Array(0, 0);}
 }
 }
 
 for (var a in tableSeps){var f = false;for (var q1=0;q1<tableDataH.length;q1++){for (var w1=0;w1<tableDataH[q1].length;w1++){if (tableDataH[q1][w1] == a && !f){f = true;for (var e1=0;e1<tableDataH[q1].length;e1++){if (tableDataH[q1][e1]!=a)tableSeps[a][0]++;}
 for (var e1=0;e1<tableDataH.length;e1++){if (tableDataH[e1][w1]!=a)tableSeps[a][1]++;}
 }
 }
 }
 }
 }
 }
 tableDataH = null;tableDataV = null;that._buildSurface();this.destructor();}
 this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this.listAutoSizes = function() {var hor = this._availAutoSize[this._layoutView+"_hor"];var ver = this._availAutoSize[this._layoutView+"_ver"];var currentHor = (this._autoHor).join(";");var currentVer = (this._autoVer).join(";");return new Array(currentHor, currentVer, hor, ver);}
 
 this.setAutoSize = function(hor, ver) {if (hor != null){var allow = false;var data = this._availAutoSize[this._layoutView+"_hor"];for (var q=0;q<data.length;q++){allow = allow || (data[q] == hor);}
 if (allow == true){this._autoHor = hor.split(";");}
 }
 if (ver != null){var allow = false;var data = this._availAutoSize[this._layoutView+"_ver"];for (var q=0;q<data.length;q++){allow = allow || (data[q] == ver);}
 if (allow == true){this._autoVer = ver.split(";");}
 }
 }
 this._buildSurface = function() {for (var r=0;r<this.tpl.childNodes[0].childNodes.length;r++){var tr = this.tpl.childNodes[0].childNodes[r];for (var c=0;c<tr.childNodes.length;c++){var td = tr.childNodes[c];var that = this;if (!td._isSep){td._isCell = true;td.skin = this.skin;td.getId = function() {return this._idd;}
 
 td.getIndex = function() {return this._ind;}
 
 td.showHeader = function() {that.showPanel(this._idd);}
 
 td.hideHeader = function() {that.hidePanel(this._idd);}
 
 td.isHeaderVisible = function() {return that.isPanelVisible(this._idd);}
 
 td.setText = function(text) {that.setText(this._idd, text);}
 
 td.getText = function() {return that.getText(this._idd);}
 
 td.expand = function() {if (!that._isCollapsed(this._idd)) return;that._expand(this._idd, "hide");}
 
 td.collapse = function() {if (that._isCollapsed(this._idd)) return;that._collapse(this._idd, "hide");}
 
 td.isCollapsed = function() {return that._isCollapsed(this._idd);}
 
 td.dock = function() {if (!that._isCollapsed(this._idd)) return;that._expand(this._idd, "dock");that.dockWindow(this._idd);}
 
 td.undock = function() {if (that._isCollapsed(this._idd)) return;that.unDockWindow(this._idd);that._collapse(this._idd, "dock");}
 
 td.setWidth = function(width) {if (!Number(width)) return;var k = this._isBlockedWidth||false;this._isBlockedWidth = false;that._setWidth(this._idd, width);this._isBlockedWidth = k;}
 
 td.getWidth = function() {return parseInt(this.style.width);}
 
 td.setHeight = function(height) {if (!Number(height)) return;var k = this._isBlockedHeight||false;this._isBlockedHeight = false;that._setHeight(this._idd, height);this._isBlockedHeight = k;}
 
 td.getHeight = function() {return parseInt(this.style.height);}
 
 td.fixSize = function(width, height) {that._fixSize(this._idd, width, height);}
 
 td.progressOn = function() {that._progressControl(this._idd, true);}
 
 td.progressOff = function() {that._progressControl(this._idd, false);}
 
 
 td._doOnAttachMenu = function() {this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));this.updateNestedObjects();}
 td._doOnAttachToolbar = function() {this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));this.updateNestedObjects();}
 td._doOnAttachStatusBar = function() {this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));this.updateNestedObjects();}
 
 
 td._doOnFrameContentLoaded = function(){that.callEvent("onContentLoaded", [this._idd]);}
 
 td._doOnResize = function() {this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));this.updateNestedObjects();}
 
 td._redraw = function() {}
 
 td.showArrow = function() {this.childNodes[0].childNodes[0].childNodes[4].style.display = "";}
 td.hideArrow = function() {this.childNodes[0].childNodes[0].childNodes[4].style.display = "none";}
 td.isArrowVisible = function() {return (this.childNodes[0].childNodes[0].childNodes[4].style.display!="none");}
 
 
 }
 
 if (td._dir == "ver"){td.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 if (_isIE){td["ondblclick"] = function() {that._doOnDoubleClick(this);}
 }
 td[this._isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (!_isIE){if (!this._lastClick){this._lastClick = new Date().getTime();}else {var t = this._lastClick;this._lastClick = new Date().getTime();if (t + that._dblClickTM >= this._lastClick){if (that._doOnDoubleClick(this)=== true) return;}
 }
 }
 var p = that._findDockCellsVer(this);that._resAreaData = new Array();if (p[0] != null && p[1] != null){if (String(document.body.className).search("dhxCursorWResize") == -1) {document.body.className += " dhxCursorWResize";}
 that._resObj = this;that._anyExpL = p[0];that._anyExpR = p[1];that._collectResAreaData(p);that._resX = (that._isIPad?e.touches[0].clientX:e.clientX);if (that._effects["resize"] == false){that._attachSizer(this);that.sizer._leftXStart = parseInt(that.sizer.style.left);var objLeft = that.polyObj[that._anyExpL[0]];that._resXMaxWidthLeft = parseInt(objLeft.style.width)-that._minWidth;var objRight = that.polyObj[that._anyExpR[0]];that._resXMaxWidthRight = parseInt(objRight.style.width)-that._minWidth;if (that._alterSizes.length > 0){for (var q=0;q<that._alterSizes.length;q++){for (var w=0;w<that._anyExpL.length;w++){if (that._alterSizes[q][0] == that._anyExpL[w]){var newVal = that._resXMaxWidthLeft = parseInt(objLeft.style.width)-that._alterSizes[q][1];if (newVal < that._resXMaxWidthLeft){that._resXMaxWidthLeft = newVal;}
 }
 }
 for (var w=0;w<that._anyExpR.length;w++){if (that._alterSizes[q][0] == that._anyExpR[w]){newVal = parseInt(objRight.style.width)-that._alterSizes[q][1];if (newVal < that._resXMaxWidthRight){that._resXMaxWidthRight = newVal;}
 }
 }
 }
 }
 that._resXStart = that._resX;}
 
 that._resFunc = that._resizeVer;that._showCovers();if (that._isIPad)e.preventDefault();}
 }
 td.onmouseup = function() {if (that._effects["resize"] == true){that._resizeStop();that._anyExpL = null;that._anyExpR = null;}
 }
 }
 if (td._dir == "hor"){td.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 td[this._isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (!this._lastClick){this._lastClick = new Date().getTime();}else {var t = this._lastClick;this._lastClick = new Date().getTime();if (t + that._dblClickTM >= this._lastClick){if (that._doOnDoubleClick(this)=== true) return;}
 }
 var p = that._findDockCellsHor(this);that._resAreaData = new Array();if (p[0] != null && p[1] != null){if (String(document.body.className).search("dhxCursorNResize") == -1) {document.body.className += " dhxCursorNResize";}
 
 that._resObj = this;that._anyExpT = p[0];that._anyExpB = p[1];that._collectResAreaData(p);that._resY = (that._isIPad?e.touches[0].clientY:e.clientY);if (that._effects["resize"] == false){that._attachSizer(this);that.sizer._topYStart = parseInt(that.sizer.style.top);var objTop = that.polyObj[that._anyExpT[0]];that._resYMaxHeightTop = parseInt(objTop.style.height)-that._minHeight;var objBottom = that.polyObj[that._anyExpB[0]];that._resYMaxHeightBottom = parseInt(objBottom.style.height)-that._minHeight;if (that._alterSizes.length > 0){for (var q=0;q<that._alterSizes.length;q++){for (var w=0;w<that._anyExpT.length;w++){if (that._alterSizes[q][0] == that._anyExpT[w]){var newVal = parseInt(objTop.style.height)-that._alterSizes[q][2]-(objTop.childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0);if (newVal < that._resYMaxHeightTop){that._resYMaxHeightTop = newVal;}
 }
 }
 for (var w=0;w<that._anyExpB.length;w++){if (that._alterSizes[q][0] == that._anyExpB[w]){var newVal = parseInt(objBottom.style.height)-that._alterSizes[q][2]-(objBottom.childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0);if (newVal < that._resYMaxHeightBottom){that._resYMaxHeightBottom = newVal;}
 }
 }
 }
 }
 that._resYStart = that._resY;}
 
 that._resFunc = that._resizeHor;that._showCovers();if (that._isIPad)e.preventDefault();}
 }
 td.onmouseup = function() {if (that._effects["resize"] == true){that._resizeStop();that._anyExpT = null;that._anyExpB = null;}
 }
 }
 }
 }
 
 for (var a in this.polyObj){this.polyObj[a]._collapsed = false;this.polyObj[a]._idd = a;this.polyObj[a]._ind = this.items.length;this.items[this.items.length] = this.polyObj[a];var nod = document.createElement("DIV");nod.style.position = "relative";nod.style.left = "0px";nod.style.top = "0px";nod.style.width = this.polyObj[a].style.width;nod.style.height = this.polyObj[a].style.height;nod.style.overflow = "hidden";this.polyObj[a].appendChild(nod);var bar = document.createElement("DIV");bar._dockCell = a;bar._resize = this.polyObj[a]._resize;bar.className = "dhtmlxPolyInfoBar";bar.innerHTML = "<div class='dhtmlxInfoBarLabel'>"+a+"</div>"+
 "<div class='dhtmlxInfoBarButtonsFake'><div class='dhtmlxInfoBarButtonsFake2'></div></div>"+
 "<div class='dhtmlxInfoButtonDock' title='"+this.i18n.dock+"'></div>"+
 "<div class='dhtmlxInfoButtonUnDock' style='display: none;' title='"+this.i18n.undock+"'></div>"+
 "<div class='dhtmlxInfoButtonShowHide_"+bar._resize+"' title='"+this.i18n.collapse+"'></div>"+
 "<div class='dhtmlxLineL'></div>"+
 "<div class='dhtmlxLineR'></div>";if (this.polyObj[a]._initCPanel == true){bar._h = this._CPanelHeight;bar.style.display = "";}else {bar._h = 0;bar.style.display = "none";}
 
 this.polyObj[a].childNodes[0].appendChild(bar);bar.ondblclick = function() {that.callEvent("onDblClick", [this._dockCell]);}
 bar.childNodes[4].onclick = function() {var pId = this.parentNode._dockCell;if (that._isCollapsed(pId)) {that._expand(pId, "hide");}else {that._collapse(pId, "hide");}
 }
 
 for (var r=0;r<bar.childNodes.length;r++){bar.childNodes[r].onselectstart = function(e) {e = e||event;e.returnValue = false;}
 }
 
 var contObj = document.createElement("DIV");contObj.className = "dhxcont_global_content_area";this.polyObj[a].childNodes[0].appendChild(contObj);var cont = new dhtmlXContainer(this.polyObj[a]);cont.setContent(contObj);if (this.skin == "dhx_web")this.polyObj[a]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_layout_dhx_web");if (this.skin == "dhx_terrace")this.polyObj[a]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_layout_dhx_terrace");this.polyObj[a].adjustContent(this.polyObj[a].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);}
 this._fixIcons();}
 
 this._resX = null;this._resY = null;this._resObj = null;this._resFunc = null;this._anyExpL = null;this._anyExpR = null;this._anyExpT = null;this._anyExpB = null;this._expand = function(pId, mode) {this._doExpand(this.polyObj[pId]._resize, pId, this.polyObj[pId]._rowData, mode);}
 this._collapse = function(pId, mode) {if (this._isCollapsed(pId)) return;this.polyObj[pId]._savedW = parseInt(this.polyObj[pId].style.width);this.polyObj[pId]._savedH = parseInt(this.polyObj[pId].style.height);this._doCollapse(this.polyObj[pId]._resize, pId, this.polyObj[pId]._rowData, mode);}
 this._isCollapsed = function(pId) {return this.polyObj[pId]._collapsed;}
 
 this._checkAlterMinSize = function(data) {this._alterSizes = new Array();for (var q=0;q<data.length;q++){for (var w=0;w<data[q].length;w++){if (this.polyObj[data[q][w]].vs[this.polyObj[data[q][w]].av].layout != null){var dims = this.polyObj[data[q][w]].vs[this.polyObj[data[q][w]].av].layout._defineWindowMinDimension(this.polyObj[data[q][w]], true);dims[0] = data[q][w];this._alterSizes[this._alterSizes.length] = dims;}
 }
 }
 }
 
 this._findDockCellsVer = function(resObj) {var res = new Array(null, null);if (resObj == null){return res;}
 
 var anyExpL = null;for (var q=resObj._left.length-1;q>=0;q--){if (anyExpL == null){if (typeof(resObj._left[q])== "object") {var isBlocked = false;for (var w=0;w<resObj._left[q].length;w++){isBlocked = isBlocked || (this.polyObj[resObj._left[q][w]]._isBlockedWidth||false);}
 if (!isBlocked){anyExpL = resObj._left[q];}
 }else if(this.polyObj[resObj._left[q]]._collapsed == false){if (!this.polyObj[resObj._left[q]]._isBlockedWidth){anyExpL = resObj._left[q];}
 }
 }
 }
 
 var anyExpR = null;for (var q=0;q<resObj._right.length;q++){if (anyExpR == null){if (typeof(resObj._right[q])== "object") {var isBlocked = false;for (var w=0;w<resObj._right[q].length;w++){isBlocked = isBlocked || (this.polyObj[resObj._right[q][w]]._isBlockedWidth||false);}
 if (!isBlocked){anyExpR = resObj._right[q];}
 }else if(this.polyObj[resObj._right[q]]._collapsed == false){if (!this.polyObj[resObj._right[q]]._isBlockedWidth){anyExpR = resObj._right[q];}
 }
 }
 }
 
 if (anyExpL == null || anyExpR == null){return res;}
 
 if (typeof(anyExpL)== "string") {anyExpL = new Array(anyExpL);}
 if (typeof(anyExpR)== "string") {anyExpR = new Array(anyExpR);}
 
 res[0] = anyExpL;res[1] = anyExpR;this._checkAlterMinSize(res);this._minWLAlter = 0;this._minWRAlter = 0;if (this._alterSizes.length > 0 && this._effects["resize"] == true){var objL = new Array();var objR = new Array();for (var q=0;q<anyExpL.length;q++){objL[q] = this.polyObj[anyExpL[q]];}
 for (var q=0;q<anyExpR.length;q++){objR[q] = this.polyObj[anyExpR[q]];}
 for (var q=0;q<objL.length;q++){for (var w=0;w<this._alterSizes.length;w++){if (this._alterSizes[w][0] == objL[q]._idd && this._minWLAlter < this._alterSizes[w][1]){this._minWLAlter = this._alterSizes[w][1];}}}
 for (var q=0;q<objR.length;q++){for (var w=0;w<this._alterSizes.length;w++){if (this._alterSizes[w][0] == objR[q]._idd && this._maxWRAlter < this._alterSizes[w][1]){this._minWRAlter = this._alterSizes[w][1];}}}
 }
 return res;}
 
 this._findDockCellsHor = function(resObj) {var res = new Array(null, null);if (resObj == null){return res;}
 
 var anyExpT = null;for (var q=resObj._top.length-1;q>=0;q--){if (anyExpT == null){if (typeof(resObj._top[q])== "object") {var isBlocked = false;for (var w=0;w<resObj._top[q].length;w++){isBlocked = isBlocked || (this.polyObj[resObj._top[q][w]]._isBlockedHeight||false);}
 if (!isBlocked){anyExpT = resObj._top[q];}
 }else if(this.polyObj[resObj._top[q]]._collapsed == false){if (!this.polyObj[resObj._top[q]]._isBlockedHeight){anyExpT = resObj._top[q];}
 }
 }
 }
 
 var anyExpB = null;for (var q=0;q<resObj._bottom.length;q++){if (anyExpB == null){if (typeof(resObj._bottom[q])== "object") {var isBlocked = false;for (var w=0;w<resObj._bottom[q].length;w++){isBlocked = isBlocked || (this.polyObj[resObj._bottom[q][w]]._isBlockedHeight||false);}
 if (!isBlocked){anyExpB = resObj._bottom[q];}
 }else if(this.polyObj[resObj._bottom[q]]._collapsed == false){if (!this.polyObj[resObj._bottom[q]]._isBlockedHeight){anyExpB = resObj._bottom[q];}
 }
 }
 }
 
 if (anyExpT == null || anyExpB == null){return res;}
 
 if (typeof(anyExpT)== "string") {anyExpT = new Array(anyExpT);}
 if (typeof(anyExpB)== "string") {anyExpB = new Array(anyExpB);}
 
 res[0] = anyExpT;res[1] = anyExpB;this._checkAlterMinSize(res);this._minHTAlter = 0;this._minHBAlter = 0;if (this._alterSizes.length > 0 && this._effects["resize"] == true){var objT = new Array();var objB = new Array();for (var q=0;q<anyExpT.length;q++){objT[q] = this.polyObj[anyExpT[q]];}
 for (var q=0;q<anyExpB.length;q++){objB[q] = this.polyObj[anyExpB[q]];}
 for (var q=0;q<objT.length;q++){for (var w=0;w<this._alterSizes.length;w++){if (this._alterSizes[w][0] == objT[q]._idd && this._minHTAlter < this._alterSizes[w][2]){this._minHTAlter = this._alterSizes[w][2];}}}
 for (var q=0;q<objB.length;q++){for (var w=0;w<this._alterSizes.length;w++){if (this._alterSizes[w][0] == objB[q]._idd && this._minHBAlter < this._alterSizes[w][2]){this._minHBAlter = this._alterSizes[w][2];}}}
 }
 
 return res;}
 
 this._resizeVer = function(e) {if (this._isIPad)e.preventDefault();if (this._resObj == null || this._anyExpL == null || this._anyExpR == null)return;var cx = (this._isIPad?e.touches[0].clientX:e.clientX);if (this._effects["resize"] == false){this._resX = cx;var offsetX = cx - this._resXStart;if (-offsetX > this._resXMaxWidthLeft && offsetX < 0){offsetX = -this._resXMaxWidthLeft;this._resX = offsetX+this._resXStart;}
 if (offsetX > this._resXMaxWidthRight && offsetX > 0){offsetX = this._resXMaxWidthRight;this._resX = offsetX+this._resXStart;}
 this.sizer.style.left = this.sizer._leftXStart+offsetX+"px";return;}
 
 var anyExpL = this._anyExpL;var anyExpR = this._anyExpR;var newX = cx;var offsetX = cx - that._resX;var objL = new Array();var objR = new Array();for (var q=0;q<anyExpL.length;q++){objL[q] = this.polyObj[anyExpL[q]];}
 for (var q=0;q<anyExpR.length;q++){objR[q] = this.polyObj[anyExpR[q]];}
 
 var wL = parseInt(objL[0].style.width);var wR = parseInt(objR[0].style.width);if (offsetX < 0){var newWL = wL + offsetX;if (newWL > objL[0]._minW && newWL > this._minWLAlter){var newWR = wR + wL - newWL;for (var q=0;q<objL.length;q++)this._setW(objL[q], newWL);for (var q=0;q<objR.length;q++)this._setW(objR[q], newWR);this._resX = newX;}
 }else if (offsetX > 0){var newWR = wR - offsetX;if (newWR > objR[0]._minW && newWR > this._minWRAlter){var newWL = wL + wR - newWR;for (var q=0;q<objL.length;q++)this._setW(objL[q], newWL);for (var q=0;q<objR.length;q++)this._setW(objR[q], newWR);this._resX = newX;}
 }
 }
 this._resizeHor = function(e) {if (this._resObj == null || this._anyExpT == null || this._anyExpB == null)return;var cy = (this._isIPad?e.touches[0].clientY:e.clientY);if (this._effects["resize"] == false){this._resY = cy;var offsetY = cy - this._resYStart;if (-offsetY > this._resYMaxHeightTop && offsetY < 0){offsetY = -this._resYMaxHeightTop;this._resY = offsetY + this._resYStart;}
 if (offsetY > this._resYMaxHeightBottom && offsetY > 0){offsetY = this._resYMaxHeightBottom;this._resY = offsetY + this._resYStart;}
 this.sizer.style.top = this.sizer._topYStart+offsetY+"px";return;}
 
 var anyExpT = this._anyExpT;var anyExpB = this._anyExpB;var newY = cy;var offsetY = cy - that._resY;var objT = new Array();var objB = new Array();for (var q=0;q<anyExpT.length;q++){objT[q] = this.polyObj[anyExpT[q]];}
 for (var q=0;q<anyExpB.length;q++){objB[q] = this.polyObj[anyExpB[q]];}
 
 var hT = parseInt(objT[0].style.height);var hB = parseInt(objB[0].style.height);if (offsetY < 0){var newHT = hT + offsetY;if (newHT > objT[0]._minH + this._minHTAlter){var newHB = hB + hT - newHT;for (var q=0;q<objT.length;q++)this._setH(objT[q], newHT);for (var q=0;q<objB.length;q++)this._setH(objB[q], newHB);this._resY = newY;}
 }else if (offsetY > 0){var newHB = hB - offsetY;if (newHB > objB[0]._minH + this._minHBAlter){var newHT = hT + hB - newHB;for (var q=0;q<objT.length;q++)this._setH(objT[q], newHT);for (var q=0;q<objB.length;q++)this._setH(objB[q], newHB);this._resY = newY;}
 }
 }
 
 this._resizeStop = function() {var p = document.body.className;if (p.search("dhxCursorWResize")!== -1 || p.search("dhxCursorNResize") !== -1) {document.body.className = String(document.body.className).replace(/dhxCursorWResize/g,"").replace(/dhxCursorNResize/g,"");}
 if (this._resObj == null)return;if (this._effects["resize"] == false){this.sizer.style.display = "none";if (this._resObj._dir == "hor"){var objTop = (typeof(this._anyExpT[0])=="object"?this._anyExpT[0][0]:this._anyExpT[0]);var offsetY = this._resY-this._resYStart;var newH = parseInt(this.polyObj[objTop].style.height)+offsetY;this._setHeight(objTop, newH);}else {var objLeft = (typeof(this._anyExpL[0])=="object"?this._anyExpL[0][0]:this._anyExpL[0]);var offsetX = this._resX-this._resXStart;var newW = parseInt(this.polyObj[objLeft].style.width)+offsetX;this._setWidth(objLeft, newW);}
 
 var objs = {};var parseData = function(data) {if (data != null){for (var q=0;q<data.length;q++){if (typeof(data[q])== "object") parseData(data[q]);objs[data[q]] = true;}
 }
 }
 parseData(this._anyExpT);parseData(this._anyExpB);parseData(this._anyExpL);parseData(this._anyExpR);var ids = new Array();for (var a in objs){ids[ids.length] = a;}
 
 
 if (typeof(this._anyExpT)== "object" && this._anyExpT != null) {this.updateNestedObjectsArray(this._anyExpT);this._anyExpT = null;}
 if (typeof(this._anyExpB)== "object" && this._anyExpB != null) {this.updateNestedObjectsArray(this._anyExpB);this._anyExpB = null;}
 if (typeof(this._anyExpL)== "object" && this._anyExpL != null) {this.updateNestedObjectsArray(this._anyExpL);this._anyExpL = null;}
 if (typeof(this._anyExpR)== "object" && this._anyExpR != null) {this.updateNestedObjectsArray(this._anyExpR);this._anyExpR = null;}
 
 
 this._resObj = null;this._resFunc = null;this._hideCovers();this._fixToolbars();this._fixCollapsedText();this.callEvent("onPanelResizeFinish", [ids]);return;}
 
 var poly = new Array();if (this._resObj._left != null){for (var q=0;q<this._resObj._left.length;q++){poly[poly.length] = this._resObj._left[q];}}
 if (this._resObj._right != null){for (var q=0;q<this._resObj._right.length;q++){poly[poly.length] = this._resObj._right[q];}}
 if (this._resObj._top != null){for (var q=0;q<this._resObj._top.length;q++){poly[poly.length] = this._resObj._top[q];}}
 if (this._resObj._bottom != null){for (var q=0;q<this._resObj._bottom.length;q++){poly[poly.length] = this._resObj._bottom[q];}}
 this._resFunc = null;this._resObj = null;this._hideCovers();var cells = new Array();for (var q=0;q<poly.length;q++){if (typeof(poly[q])== "object") {for (var w=0;w<poly[q].length;w++){cells[cells.length] = this.polyObj[poly[q][w]];}
 }else {cells[cells.length] = this.polyObj[poly[q]];}
 }
 for (var q=0;q<cells.length;q++)cells[q].updateNestedObjects();this._fixCollapsedText();this.callEvent("onPanelResizeFinish", []);}
 this._showCovers = function() {for (var a in this.polyObj){if (this._effects["highlight"] && this._isResizable(a)) {this.polyObj[a].showCoverBlocker();}}
 this._fixToolbars();}
 this._hideCovers = function() {for (var a in this.polyObj){this.polyObj[a].hideCoverBlocker();}
 this._fixToolbars();}
 this._isResizable = function(pId) {var need = false;for (var q=0;q<this._resAreaData.length;q++){need = need || (this._resAreaData[q] == pId);}
 return need;}
 this._collectResAreaData = function(obj) {for (var q=0;q<obj.length;q++){if (typeof(obj[q])== "string") {this._resAreaData[this._resAreaData.length] = obj[q];}else if (typeof(obj[q])== "object") {this._collectResAreaData(obj[q]);}
 }
 }
 this._doOnDoubleClick = function(sep) {if (sep._dblClick == null)return;if (this.polyObj[sep._dblClick] == null)return;if (this.polyObj[sep._dblClick]._noHeader)return;var obj = this.polyObj[sep._dblClick];if (obj.childNodes[0].style.display == "none")return;if (obj._collapsed == true){this._doExpand(obj._resize, sep._dblClick, obj._rowData, "hide");}else {obj._savedW = parseInt(obj.style.width);obj._savedH = parseInt(obj.style.height);this._doCollapse(obj._resize, sep._dblClick, obj._rowData, "hide");}
 return true;}
 
 this._doOnSelectStart = function(e) {e = e||event;if (that._resObj != null)e.returnValue = false;}
 this._doOnMouseMove = function(e) {e = e||event;if (that._resObj != null && that._resFunc != null)that._resFunc(e);}
 this._doOnMouseUp = function() {that._resizeStop();}
 
 
 if (this._isIPad){document.addEventListener("touchmove", that._doOnMouseMove, false);document.addEventListener("touchend", that._doOnMouseUp, false);}else {if (_isIE){document.body.attachEvent("onselectstart", that._doOnSelectStart);document.body.attachEvent("onmousemove", that._doOnMouseMove);document.body.attachEvent("onmouseup", that._doOnMouseUp);}else {document.body.addEventListener("mousemove", that._doOnMouseMove, false);document.body.addEventListener("mouseup", that._doOnMouseUp, false);}
 }
 
 this._doExpand = function(dir, pId, rowData, mode) {if (rowData.length <= 1)return;var ind = -1;for (var q=0;q<rowData.length;q++){if (rowData[q] == pId){ind = q;}}
 if (ind == -1)return;var anyExp = null;for (var q=ind+1;q<rowData.length;q++){if (anyExp == null){if (typeof(rowData[q])== "string") {if (this.polyObj[rowData[q]]._collapsed == false){anyExp = rowData[q];}}else {anyExp = rowData[q];}
 }
 }
 
 if (anyExp == null){for (var q=ind-1;q>=0;q--){if (anyExp == null){if (typeof(rowData[q])== "string") {if (this.polyObj[rowData[q]]._collapsed == false){anyExp = rowData[q];}}else {anyExp = rowData[q];}
 }
 }
 }
 if (anyExp == null)return;if (typeof(anyExp)!= "object") {anyExp = new Array(anyExp);}
 if (dir == "hor"){var availSpace = 65536;for (var q=0;q<anyExp.length;q++){var newDim = (this.polyObj[anyExp[q]].vs[this.polyObj[anyExp[q]].av].layout!=null?this.polyObj[anyExp[q]].vs[this.polyObj[anyExp[q]].av].layout._defineWindowMinDimension(this.polyObj[anyExp[q]],true):[0,0]);var av2 = parseInt(this.polyObj[anyExp[q]].style.width) - this._minWidth - newDim[1];if (av2 < availSpace)availSpace = av2;}
 var maxSize = this.polyObj[pId]._savedW;if (maxSize > availSpace)maxSize = availSpace;if (maxSize < this._minWidth)return;var step = Math.round(maxSize/3);}else {var availSpace = 65536;for (var q=0;q<anyExp.length;q++){var newDim = (this.polyObj[anyExp[q]].vs[this.polyObj[anyExp[q]].av].layout!=null?this.polyObj[anyExp[q]].vs[this.polyObj[anyExp[q]].av].layout._defineWindowMinDimension(this.polyObj[anyExp[q]],true):[0,0,0]);var av2 = parseInt(this.polyObj[anyExp[q]].style.height) - this._minHeight - newDim[2];if (av2 < availSpace)availSpace = av2;}
 
 var maxSize = this.polyObj[pId]._savedH;if (maxSize > availSpace)maxSize = availSpace;if (maxSize < this._minHeight)return;var step = Math.round(maxSize/3);}
 
 
 this.polyObj[pId].childNodes[0].childNodes[1].style.display = "";this.polyObj[pId].childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBar";this.polyObj[pId].childNodes[0].childNodes[0].childNodes[1].style.display = "";this.polyObj[pId].childNodes[0].childNodes[0].childNodes[2].style.display = "";this.polyObj[pId].childNodes[0].childNodes[0].childNodes[4].style.display = "";var obj2 = new Array();for (var q=0;q<anyExp.length;q++){obj2[q] = this.polyObj[anyExp[q]];}
 
 
 if (this.polyObj[pId].className == "dhtmlxLayoutSinglePolyTabbarCollapsed"){this.polyObj[pId].className = "dhtmlxLayoutSinglePolyTabbar";}
 this._expandEffect(this.polyObj[pId], obj2, maxSize, mode, (this._effects["collapse"]==true?step:1000000), dir);}
 this._doCollapse = function(dir, pId, rowData, mode) {if (rowData.length <= 1)return;var ind = -1;for (var q=0;q<rowData.length;q++){if (rowData[q] == pId){ind = q;}}
 if (ind == -1)return;var anyExp = null;for (var q=ind+1;q<rowData.length;q++){if (anyExp == null){if (typeof(rowData[q])== "string") {if (this.polyObj[rowData[q]]._collapsed == false){anyExp = rowData[q];}}else {anyExp = rowData[q];}
 }
 }
 
 if (anyExp == null){for (var q=ind-1;q>=0;q--){if (anyExp == null){if (typeof(rowData[q])== "string") {if (this.polyObj[rowData[q]]._collapsed == false){anyExp = rowData[q];}}else {anyExp = rowData[q];}
 }
 }
 }
 if (anyExp == null){if (rowData[ind+1] != null){anyExp = rowData[ind+1];}
 }
 
 if (anyExp == null){if (ind-1 >= 0){if (rowData[ind-1] != null){anyExp = rowData[ind-1];}
 }
 }
 
 if (anyExp != null){if (typeof(anyExp)!= "object") {if (this.polyObj[anyExp]._collapsed == true){this.polyObj[anyExp].childNodes[0].childNodes[1].style.display = "";this.polyObj[anyExp]._collapsed = false;this.polyObj[anyExp].childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBar";this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[1].style.display = "";this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[4].title = this.i18n.collapse;this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[2].style.display = "";this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[3].style.display = "none";this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[4].style.display = "";if (this.polyObj[anyExp]._isUnDocked === true){this.dockWindow(anyExp);}
 
 
 if (this.polyObj[anyExp].className == "dhtmlxLayoutSinglePolyTabbarCollapsed"){this.polyObj[anyExp].className = "dhtmlxLayoutSinglePolyTabbar";}
 
 this._fixSplitters();this._fixIcons();this.polyObj[anyExp].removeAttribute("title");this._fixToolbars();this.callEvent("onExpand", [anyExp]);}
 
 anyExp = new Array(anyExp);}
 var obj2 = new Array();for (var q=0;q<anyExp.length;q++){obj2[q] = this.polyObj[anyExp[q]];}
 
 if (dir == "hor"){var step = Math.round(Math.max(this.polyObj[pId].offsetWidth, this.polyObj[anyExp[0]].offsetWidth)/3);}else {var step = Math.round(Math.max(this.polyObj[pId].offsetHeight, this.polyObj[anyExp[0]].offsetHeight)/3);}
 
 this.polyObj[pId].childNodes[0].childNodes[1].style.display = "none";this._collapseEffect(this.polyObj[pId], obj2, mode, (this._effects["collapse"]==true?step:1000000), dir);}
 }
 
 
 this.setEffect = function(efName, efValue) {if (this._effects[efName] != null && typeof(efValue)== "boolean") {this._effects[efName] = efValue;}
 }
 
 this.getEffect = function(efName) {if (this._effects[efName] != null){return this._effects[efName];}
 return null;}
 
 this._expandEffect = function(obj, obj2, maxSize, mode, step, dir) {if (dir == "hor"){var s = parseInt(obj.style.width);var s2 = parseInt(obj2[0].style.width);}else {var s = parseInt(obj.style.height);var s2 = parseInt(obj2[0].style.height);}
 var newS = s + step;if (newS > maxSize){newS = maxSize;}
 
 if (dir == "hor"){obj.style.width = newS+"px";obj.childNodes[0].style.width = obj.style.width;}else {obj.style.height = newS+"px";obj.childNodes[0].style.height = obj.style.height;}
 obj.adjustContent(obj.childNodes[0], (obj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));for (var q=0;q<obj2.length;q++){if (dir == "hor"){obj2[q].style.width = s2+s-newS+"px";obj2[q].childNodes[0].style.width = obj2[q].style.width;}else {obj2[q].style.height = s2+s-newS+"px";obj2[q].childNodes[0].style.height = obj2[q].style.height;}
 obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));}
 
 if (newS != maxSize){window.setTimeout(function(){that._expandEffect(obj, obj2, maxSize, mode, step, dir);}, 4);}else {obj._collapsed = false;for (var q=0;q<obj2.length;q++){obj2[q].updateNestedObjects();}
 this.polyObj[obj._idd].updateNestedObjects();this.polyObj[obj._idd].childNodes[0].childNodes[0].childNodes[4].title = this.i18n.collapse;this._fixSplitters();this._fixIcons();obj.removeAttribute("title");this._fixToolbars();this.callEvent("onExpand", [obj._idd]);}
 }
 this._collapseEffect = function(obj, obj2, mode, step, dir) {if (dir == "hor"){var s = parseInt(obj.style.width);var s2 = parseInt(obj2[0].style.width);}else {var s = parseInt(obj.style.height);var s2 = parseInt(obj2[0].style.height);}
 var newS = s - step;if (dir == "hor"){if (newS < this._collapsedW){newS = this._collapsedW;}
 obj.style.width = newS+"px";obj.childNodes[0].style.width = obj.style.width;}else {if (newS < this._collapsedH){newS = this._collapsedH;}
 obj.style.height = newS+"px";obj.childNodes[0].style.height = obj.style.height;}
 
 
 
 for (var q=0;q<obj2.length;q++){if (dir == "hor"){obj2[q].style.width = s2+(s-newS)+"px";obj2[q].childNodes[0].style.width = obj2[q].style.width;}else {obj2[q].style.height = s2+(s-newS)+"px";obj2[q].childNodes[0].style.height = obj2[q].style.height;}
 obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));}
 
 
 if ((newS > this._collapsedW && dir == "hor")|| (newS > this._collapsedH && dir == "ver")) {window.setTimeout(function(){that._collapseEffect(obj, obj2, mode, step, dir);}, 4);}else {for (var q=0;q<obj2.length;q++){if (dir == "hor"){obj2[q].style.width = s2+(s-newS)+"px";obj2[q].childNodes[0].style.width = obj2[q].style.width;}else {obj2[q].style.height = s2+(s-newS)+"px";obj2[q].childNodes[0].style.height = obj2[q].style.height;}
 obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));}
 
 obj._collapsed = true;if (dir == "hor"){obj.childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBarCollapsedVer";}else {obj.childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBarCollapsedHor";}
 
 for (var q=0;q<obj2.length;q++){obj2[q].updateNestedObjects();}
 
 if (mode == "hide"){obj.childNodes[0].childNodes[0].childNodes[1].style.display = "";obj.childNodes[0].childNodes[0].childNodes[2].style.display = "none";obj.childNodes[0].childNodes[0].childNodes[3].style.display = "none";obj.childNodes[0].childNodes[0].childNodes[4].style.display = "";}else {obj.childNodes[0].childNodes[0].childNodes[1].style.display = "";obj.childNodes[0].childNodes[0].childNodes[2].style.display = "";obj.childNodes[0].childNodes[0].childNodes[3].style.display = "none";obj.childNodes[0].childNodes[0].childNodes[4].style.display = "none";}
 
 if (obj.className == "dhtmlxLayoutSinglePolyTabbar"){obj.className = "dhtmlxLayoutSinglePolyTabbarCollapsed";}
 this.polyObj[obj._idd].childNodes[0].childNodes[0].childNodes[4].title = this.i18n.expand;this._fixSplitters();this._fixIcons();obj.title = this.getTextTooltip(obj._idd);this._fixToolbars();this._fixCollapsedText();this.callEvent("onCollapse", [obj._idd]);}
 }
 
 this._setW = function(cellObj, w) {cellObj.style.width = w + "px";cellObj.childNodes[0].style.width = cellObj.style.width;cellObj.adjustContent(cellObj.childNodes[0], (cellObj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));}
 this._setH = function(cellObj, h) {cellObj.style.height = h + "px";cellObj.childNodes[0].style.height = cellObj.style.height;cellObj.adjustContent(cellObj.childNodes[0], (cellObj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));}
 this._setWidth = function(pId, width) {if (this.polyObj[pId] == null)return;if (!Number(width)) return;var sep = null;for (var q=0;q<this.sepVer.length;q++){var p = this.sepVer[q]._left;if (p[p.length-1] == pId){sep = new Array(this.sepVer[q], "left");}else if (typeof(p[p.length-1])== "object") {var k = p[p.length-1];for (var e=0;e<k.length;e++){if (k[e] == pId){sep = new Array(this.sepVer[q], "left");}}
 }
 
 var p = this.sepVer[q]._right;if (p[0] == pId){sep = new Array(this.sepVer[q], "right");}else if (typeof(p[0])== "object") {var k = p[0];for (var e=0;e<k.length;e++){if (k[e] == pId){sep = new Array(this.sepVer[q], "right");}}
 }
 }
 if (sep != null){var set = this._findDockCellsVer(sep[0]);var anyExpL = set[0];var anyExpR = set[1];if (anyExpL == null || anyExpR == null)return;var sumSize = parseInt(this.polyObj[anyExpL[0]].style.width) + parseInt(this.polyObj[anyExpR[0]].style.width);if (width < this._minWidth){width = this._minWidth;}else if (width > sumSize - this._minWidth){width = sumSize - this._minWidth;}
 var width2 = sumSize - width;for (var q=0;q<anyExpL.length;q++){this._setW(this.polyObj[anyExpL[q]],(sep[1]=="left"?width:width2));this.polyObj[anyExpL[q]].updateNestedObjects();}
 for (var q=0;q<anyExpR.length;q++){this._setW(this.polyObj[anyExpR[q]],(sep[1]=="right"?width:width2));this.polyObj[anyExpR[q]].updateNestedObjects();}
 }
 }
 this._setHeight = function(pId, height) {if (this.polyObj[pId] == null)return;if (!Number(height)) return;var sep = null;for (var q=0;q<this.sepHor.length;q++){var p = this.sepHor[q]._top;if (p[p.length-1] == pId){sep = new Array(this.sepHor[q], "top");}else if (typeof(p[p.length-1])== "object") {var k = p[p.length-1];for (var e=0;e<k.length;e++){if (k[e] == pId){sep = new Array(this.sepHor[q], "top");}}
 }
 
 var p = this.sepHor[q]._bottom;if (p[0] == pId){sep = new Array(this.sepHor[q], "bottom");}else if (typeof(p[0])== "object") {var k = p[0];for (var e=0;e<k.length;e++){if (k[e] == pId){sep = new Array(this.sepHor[q], "bottom");}}
 }
 }
 if (sep != null){var set = this._findDockCellsHor(sep[0]);var anyExpT = set[0];var anyExpB = set[1];if (anyExpT == null || anyExpB == null)return;var sumSize = parseInt(this.polyObj[anyExpT[0]].style.height) + parseInt(this.polyObj[anyExpB[0]].style.height);if (height < this._minHeight){height = this._minHeight;}else if (height > sumSize - this._minHeight){height = sumSize - this._minHeight;}
 var height2 = sumSize - height;for (var q=0;q<anyExpT.length;q++){this._setH(this.polyObj[anyExpT[q]],(sep[1]=="top"?height:height2));this.polyObj[anyExpT[q]].updateNestedObjects();}
 for (var q=0;q<anyExpB.length;q++){this._setH(this.polyObj[anyExpB[q]],(sep[1]=="bottom"?height:height2));this.polyObj[anyExpB[q]].updateNestedObjects();}
 }
 }
 this.updateNestedObjectsArray = function(obj) {for (var q=0;q<obj.length;q++){if (typeof(obj[q])=="object") {this.updateNestedObjectsArray(obj[q]);}else {this.polyObj[obj[q]].updateNestedObjects();}
 }
 }
 this.dockWindow = function(id) {if (!this.dhxWins)return;if (!this.dhxWins.window(this.dhxWinsIdPrefix+id)) return;this.dhxWins.window(this.dhxWinsIdPrefix+id).close();this.dhxWins.window(this.dhxWinsIdPrefix+id).moveContentTo(this.polyObj[id]);this.polyObj[id]._isUnDocked = false;this.callEvent("onDock", [id]);}
 this.unDockWindow = function(id) {this._initWindows(id);this.polyObj[id].moveContentTo(this.dhxWins.window(this.dhxWinsIdPrefix+id));this.polyObj[id]._isUnDocked = true;this.callEvent("onUnDock", [id]);}
 
 this._initWindows = function(id) {if (!window.dhtmlXWindows)return;if (!this.dhxWins){this.dhxWins = new dhtmlXWindows();this.dhxWins.setSkin(this.skin);this.dhxWins.setImagePath(this.imagePath);this.dhxWinsIdPrefix = "";if (!id)return;}
 var idd = this.dhxWinsIdPrefix+id;if (!this.dhxWins.window(idd)) {var self = this;var w1 = this.dhxWins.createWindow(idd, 20, 20, 320, 200);w1.setText(this.polyObj[id].getText());w1.button("close").hide();w1.attachEvent("onClose", function(win){win.hide();});w1.button("dock").show();w1.button("dock").attachEvent("onClick", function(win){self.polyObj[id].dock();});w1.dockedCell = this.polyObj[id];}else {this.dhxWins.window(idd).show();}
 }
 
 this.isPanelVisible = function(pId) {return (!this.polyObj[pId]._noHeader);}
 this.showPanel = function(pId) {if (this.polyObj[pId] == null)return;if (this.polyObj[pId]._collapsed == true)return;var bar = this.polyObj[pId].childNodes[0].childNodes[0];bar.style.display = "";this.polyObj[pId]._noHeader = false;if (this.skin == "dhx_web")this.polyObj[pId]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_layout_dhx_web");if (this.skin == "dhx_terrace")this.polyObj[pId]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_layout_dhx_terrace");this.polyObj[pId].adjustContent(this.polyObj[pId].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);this.polyObj[pId].updateNestedObjects();}
 this.hidePanel = function(pId) {if (this.polyObj[pId] == null)return;if (this.polyObj[pId]._collapsed == true)return;var bar = this.polyObj[pId].childNodes[0].childNodes[0];bar.style.display = "none";this.polyObj[pId]._noHeader = true;if (this.skin == "dhx_web")this.polyObj[pId]._setPadding(this.skinParams[this.skin]["cell_pading_min"], "");if (this.skin == "dhx_terrace"){this.polyObj[pId]._setPadding(this.skinParams[this.skin]["cell_pading_min"], "");}
 this.polyObj[pId].adjustContent(this.polyObj[pId].childNodes[0], 0);this.polyObj[pId].updateNestedObjects();}
 this.setText = function(pId, text) {this._changeCPanelText(pId, text);}
 this.getText = function(pId) {return this.polyObj[pId].childNodes[0].childNodes[0].childNodes[0].innerHTML;}
 this.getTextTooltip = function(pId) {var t = this.polyObj[pId].childNodes[0].childNodes[0].childNodes[0];return (t.innerText||t.textContent);}
 this._changeCPanelText = function(pId, text) {var layout = that;if (layout.polyObj[pId] == null)return;layout.polyObj[pId].childNodes[0].childNodes[0].childNodes[0].innerHTML = text;if (that.dhxWins != null){if (that.dhxWins.window(that.dhxWinsIdPrefix+pId)!= null) {that.dhxWins.window(that.dhxWinsIdPrefix+pId).setText(text);}
 }
 }
 
 this.forEachItem = function(handler) {for (var q=0;q<this.items.length;q++){handler(this.items[q]);}
 }
 this._fixPositionInWin = function(w, h) {this.base.style.width = w+"px";this.base.style.height = h+"px";}
 
 this.attachMenu = function() {if (this.base._isWindow){this.menu = this.base._window.attachMenu();}else {this.cont.obj.skin = this.skin;this.menu = this.cont.obj.attachMenu();this.cont.obj.adjustContent(this.cont.obj, 0);this.setSizes();}
 return this.menu;}
 
 this.detachMenu = function() {if (!this.menu)return;this.cont.obj.detachMenu();this.setSizes();this.menu = null;}
 
 this.showMenu = function() {if (!this.menu)return;this.cont.obj.showMenu();this.setSizes();}
 
 this.hideMenu = function() {if (!this.menu)return;this.cont.obj.hideMenu();this.setSizes();}
 
 this.attachToolbar = function() {if (this.base._isWindow){this.toolbar = this.base._window.attachToolbar();}else {this.cont.obj.skin = this.skin;this.toolbar = this.cont.obj.attachToolbar();this.cont.obj.adjustContent(this.cont.obj, 0);this.setSizes();}
 return this.toolbar;}
 
 this.detachToolbar = function() {if (!this.toolbar)return;this.cont.obj.detachToolbar();this.setSizes();this.toolbar = null;}
 
 this.showToolbar = function() {if (!this.toolbar)return;this.cont.obj.showToolbar();this.setSizes();}
 
 this.hideToolbar = function() {if (!this.toolbar)return;this.cont.obj.hideToolbar();this.setSizes();}
 
 this.attachStatusBar = function() {if (this.base._isWindow){this.statusbar = this.base._window.attachStatusBar();}else {this.statusbar = this.cont.obj.attachStatusBar();this.cont.obj.adjustContent(this.cont.obj, 0);this.setSizes();}
 return this.statusbar;}
 
 this.detachStatusBar = function() {if (!this.statusbar)return;this.cont.obj.detachStatusBar();this.setSizes();this.statusbar = null;}
 
 this.showStatusBar = function() {if (!this.statusbar)return;this.cont.obj.showStatusBar();this.setSizes();}
 
 this.hideStatusBar = function() {if (!this.statusbar)return;this.cont.obj.hideStatusBar();this.setSizes();}
 
 this.progressOn = function() {this._progressControlGlobal(true);}
 
 this.progressOff = function() {this._progressControlGlobal(false);}
 this._progressControl = function(id, state) {if (this.polyObj[id] == null)return;if (this.polyObj[id]._progressCover == null){var p1 = document.createElement("DIV");p1.className = "dhtmlxLayoutPolyProgress";this.polyObj[id].childNodes[0].appendChild(p1);var p2 = document.createElement("DIV");p2.className = "dhtmlxLayoutPolyProgressBGIMG";this.polyObj[id].childNodes[0].appendChild(p2);this.polyObj[id]._progressCover = new Array(p1,p2);}
 
 this.polyObj[id]._progressCover[0].style.display = (state==true?"":"none");this.polyObj[id]._progressCover[1].style.display = this.polyObj[id]._progressCover[0].style.display;}
 this._progressControlGlobal = function(state) {if (this._progressCover == null){var p1 = document.createElement("DIV");p1.className = "dhtmlxLayoutPolyProgressGlobal_"+this.skin;this.obj.appendChild(p1);var p2 = document.createElement("DIV");p2.className = "dhtmlxLayoutPolyProgressBGIMGGlobal_"+this.skin;this.obj.appendChild(p2);this._progressCover = new Array(p1,p2);}
 this._progressCover[0].style.display = (state==true?"":"none");this._progressCover[1].style.display = this._progressCover[0].style.display;}
 
 this._fixSize = function(pId, width, height) {if (this.polyObj[pId] == null)return;this.polyObj[pId]._isBlockedWidth = width;this.polyObj[pId]._isBlockedHeight = height;this._fixSplitters();}
 this._fixSplitters = function() {for (var q=0;q<this.sepVer.length;q++){var data = this._findDockCellsVer(this.sepVer[q]);if (data[0] == null || data[1] == null){if (this.sepVer[q].className != "dhtmlxLayoutPolySplitterVerInactive"){this.sepVer[q].className = "dhtmlxLayoutPolySplitterVerInactive";}
 }else {if (this.sepVer[q].className != "dhtmlxLayoutPolySplitterVer"){this.sepVer[q].className = "dhtmlxLayoutPolySplitterVer";}
 }
 }
 
 for (var q=0;q<this.sepHor.length;q++){var data = this._findDockCellsHor(this.sepHor[q]);if (data[0] == null || data[1] == null){if (this.sepHor[q].className != "dhtmlxLayoutPolySplitterHorInactive"){this.sepHor[q].className = "dhtmlxLayoutPolySplitterHorInactive";}
 }else {if (this.sepHor[q].className != "dhtmlxLayoutPolySplitterHor"){this.sepHor[q].className = "dhtmlxLayoutPolySplitterHor";}
 }
 }
 }
 this._fixIcons = function() {for (var a in this.polyObj){var data = this.polyObj[a]._rowData;var cps = this.polyObj[a]._collapsed;var idx = -1;for (var q=0;q<data.length;q++){if (typeof(data[q])== "object") {}else {if (data[q] == a){idx = q;}
 }
 }
 
 var newIcon = null;if (idx != -1){for (var q=idx+1;q<data.length;q++){if (typeof(data[q])== "object") {newIcon = (this.polyObj[a]._resize=="ver"?(cps?"b":"t"):(cps?"r":"l"));}else if (this.polyObj[data[q]]._collapsed == false){newIcon = (this.polyObj[a]._resize=="ver"?(cps?"b":"t"):(cps?"r":"l"));}
 }
 if (newIcon == null && idx >= 1){for (var q=idx-1;q>=0;q--){if (typeof(data[q])== "object") {newIcon = (this.polyObj[a]._resize=="ver"?(cps?"t":"b"):(cps?"l":"r"));}else if (this.polyObj[data[q]]._collapsed == false){newIcon = (this.polyObj[a]._resize=="ver"?(cps?"t":"b"):(cps?"l":"r"));}
 }
 }
 }
 
 if (newIcon != null){var dir = this.polyObj[a]._resize;this.polyObj[a].childNodes[0].childNodes[0].childNodes[4].className = "dhtmlxInfoButtonShowHide_"+dir+" dhxLayoutButton_"+this.skin+"_"+dir+(this.polyObj[a]._collapsed?"2":"1")+newIcon;}
 }
 }
 
 
 this._defineWindowMinDimension = function(win, inLayout) {if (inLayout == true){var dim = new Array();dim[0] = parseInt(win.style.width);dim[1] = parseInt(win.style.height);}else {var dim = win.getDimension();if (dim[0] == "100%"){dim[0] = win.offsetWidth;}
 if (dim[1] == "100%"){dim[1] = win.offsetHeight;}
 }
 
 var hor = that._getNearestParents("hor");var ver = that._getNearestParents("ver");if (!inLayout){var resH = new Array();var resV = new Array();for (var a in hor){resH[resH.length] = a;}
 for (var a in ver){resV[resV.length] = a;}
 that._checkAlterMinSize(new Array(resH, resV));var hor2 = {};var ver2 = {};for (var q=0;q<that._alterSizes.length;q++){var a = that._alterSizes[q][0];var w = that._alterSizes[q][1];var h = that._alterSizes[q][2];if (hor2[a] == null){hor2[a] = w;}else {if (w > hor2[a]){hor2[a] = w;}}
 if (ver2[a] == null){ver2[a] = h;}else {if (h > ver2[a]){ver2[a] = h;}}
 }
 for (var a in hor){if (hor2[a] != null){hor[a] = hor[a]-hor2[a]+that._minWidth;}}
 for (var a in ver){if (ver2[a] != null){ver[a] = ver[a]-ver2[a]+that._minHeight-(that.polyObj[a].childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0);}}
 }
 
 
 var minWidth = 65536;for (var a in hor){if (hor[a] < minWidth){minWidth = hor[a];}}
 minWidth = minWidth - that._minWidth;minWidth = dim[0] - minWidth;if (minWidth < that._dimension[0] && !inLayout){minWidth = that._dimension[0];}
 
 var minHeight = 65536;for (var a in ver){if (ver[a] < minHeight){minHeight = ver[a];}}
 minHeight = minHeight - that._minHeight;minHeight = dim[1] - minHeight;if (minHeight < that._dimension[1] && !inLayout){minHeight = that._dimension[1];}
 
 if (inLayout == true)return ["",minWidth,minHeight];win.setMinDimension(minWidth, minHeight);}
 this._getNearestParents = function(resize) {var data = (resize=="hor"?this._autoHor:this._autoVer);var pool = {};for (var q=0;q<data.length;q++){var id = data[q];if (this.polyObj[id]._collapsed == true && this.polyObj[id]._resize == resize){var rowData = this.polyObj[id]._rowData;var e = -1;for (var w=0;w<rowData.length;w++){if (typeof(rowData[w])== "object") {e = w;}else {if (rowData[w] == id)e = w;}}
 var r = e;id = null;if (e > 0){for (var w=e-1;w>=0;w--){if (typeof(rowData[w])== "object") {id = rowData[w];}else {if (this.polyObj[rowData[w]]._collapsed == false && id == null){id = rowData[w];}}}}
 if (id == null){for (var w=r;w<rowData.length;w++){if (typeof(rowData[w])== "object") {id = rowData[w];}else {if (this.polyObj[rowData[w]]._collapsed == false && id == null){id = rowData[w];}}}}
 }
 if (id != null){if (typeof(id)== "string") {id = new Array(id);}
 for (var w=0;w<id.length;w++){pool[id[w]] = parseInt(resize=="hor"?this.polyObj[id[w]].style.width:this.polyObj[id[w]].style.height);}
 }
 }
 return pool;}
 
 
 this.setSizes = function(skipAdjust) {var dim = this._defineWindowMinDimension(this.base, true);this.cont.obj.setMinContentSize(dim[1], dim[2]);this.cont.obj.adjustContent(this.cont.obj, 0);if (!this.base.offsetParent)return;if (this.cont && skipAdjust !== false)this.cont.obj.adjustContent(this.cont.obj, this._mTop, null, null, this._mBottom);var xw = this.base.offsetParent.offsetWidth-this.base.offsetWidth+(this._baseWFix!=null?this._baseWFix:0);var xh = this.base.offsetParent.offsetHeight-this.base.offsetHeight+(this._baseHFix!=null?this._baseHFix:0);this.base.style.width = parseInt(this.base.style.width)+xw+"px";this.base.style.height = parseInt(this.base.style.height)+xh+"px";var both = {};for (var a in this._getNearestParents("hor")) {this.polyObj[a].style.width = Math.max(0,parseInt(this.polyObj[a].style.width)+xw)+"px";this.polyObj[a].childNodes[0].style.width = this.polyObj[a].style.width;both[a] = 1;}
 for (var a in this._getNearestParents("ver")) {this.polyObj[a].style.height = Math.max(0,parseInt(this.polyObj[a].style.height)+xh)+"px";this.polyObj[a].childNodes[0].style.height = this.polyObj[a].style.height;both[a] = 1;}
 for (var a in both){this.polyObj[a].adjustContent(this.polyObj[a].childNodes[0], (this.polyObj[a]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));this.polyObj[a].updateNestedObjects();}
 this.callEvent("onResizeFinish", []);return;}
 
 dhtmlxEventable(this);this._init();}
dhtmlXLayoutObject.prototype.unload = function(removeParent) {if (this._isIPad){document.removeEventListener("touchmove", this._doOnMouseMove, false);document.removeEventListener("touchend", this._doOnMouseUp, false);}else {if (_isIE){document.body.detachEvent("onselectstart", this._doOnSelectStart);document.body.detachEvent("onmousemove", this._doOnMouseMove);document.body.detachEvent("onmouseup", this._doOnMouseUp);}else {document.body.removeEventListener("mousemove", this._doOnMouseMove, false);document.body.removeEventListener("mouseup", this._doOnMouseUp, false);}
 }
 this._doOnSelectStart = null;this._doOnMouseMove = null;this._doOnMouseUp = null;for (var a in this.polyObj){var p = this.polyObj[a];p._isCell = null;p.skin = null;p.getId = null;p.getIndex = null;p.showHeader = null;p.hideHeader = null;p.isHeaderVisible = null;p.setText = null;p.getText = null;p.expand = null;p.collapse = null;p.isCollapsed = null;p.dock = null;p.undock = null;p.setWidth = null;p.getWidth = null;p.setHeight = null;p.getHeight = null;p.fixSize = null;p.progressOn = null;p.progressOff = null;p._doOnAttachMenu = null;p._doOnAttachToolbar = null;p._doOnAttachStatusBar = null;p._collapsed = null;p._idd = null;p._ind = null;p._rowData = null;p._dir = null;p._initCPanel = null;p._minW = null;p._minH = null;p._resize = null;p._savedH = null;p._savedW = null;p.ondblclick = null;var bar = p.childNodes[0].childNodes[0];bar.className = "";bar._dockCell = null;bar._resize = null;bar._h = null;bar.ondblclick = null;bar.childNodes[4].onclick = null;for (var r=0;r<bar.childNodes.length;r++)bar.childNodes[r].onselectstart = null;while (bar.childNodes.length > 0)bar.removeChild(bar.childNodes[0]);bar.parentNode.removeChild(bar);bar = null;p._dhxContDestruct();p._dhxContDestruct = null;p.removeChild(p.childNodes[0]);p.parentNode.removeChild(p);p = null;}
 for (var a in this.polyObj)this.polyObj[a] = null;for (var q=0;q<this.items.length;q++)this.items[q] = null;this.polyObj = null;this.items = null;var t = this.tpl.childNodes[0];while (t.childNodes.length > 0){while (t.childNodes[0].childNodes.length > 0){var r = t.childNodes[0].childNodes[0];r._top = null;r._bottom = null;r._left = null;r._right = null;r._dblClick = null;r._isSep = null;r._dir = null;r._lastClick = null;r.ondblclick = null;r.onmousedown = null;r.onmouseup = null;r.onselectstart = null;while (r.childNodes.length > 0)r.removeChild(r.childNodes[0]);r.parentNode.removeChild(r);r = null;}
 t.removeChild(t.childNodes[0]);}
 t.parentNode.removeChild(t);t = null;this.tpl.parentNode.removeChild(this.tpl);this.tpl = null;for (var a in this.sepHor)this.sepHor[a] = null;for (var a in this.sepVer)this.sepVer[a] = null;this.sepHor = null;this.sepVer = null;if (this._ha){this.detachEvent(this._haEv);this._haEv = null;while (this._ha.childNodes.length > 0)this._ha.removeChild(this._ha.childNodes[0]);this._ha.parentNode.removeChild(this._ha);this._ha = null;}
 if (this._fa){this.detachEvent(this._faEv);this._faEv = null;while (this._fa.childNodes.length > 0)this._fa.removeChild(this._fa.childNodes[0]);this._fa.parentNode.removeChild(this._fa);this._fa = null;}
 
 this.attachHeader = null;this.attachFooter = null;this._autoHor = null;this._autoVer = null;this._availAutoSize = null;this._dimension = null;this._effects = null;this._layoutView = null;this._mBottom = null;this._mTop = null;this._minWidth = null;this._minHeight = null;this._resFunc = null;this._resObj = null;this._resX = null;this._resY = null;this._colsRatio = null;this._rowsRatio = null;this._totalCols = null;this._totalRows = null;this._xmlLoader = null;this.w = null;this.h = null;this.imagePath = null;this.skin = null;this.skinParams = null;this.tplData = null;this.tplSizes = null;this._CPanelBtnsWidth = null;this._CPanelHeight = null;if (this.sizer.parentNode)this.sizer.parentNode.removeChild(this.sizer);this.sizer = null;this._alterSizes = null;this._attachSizer = null;this._buildSurface = null;this._changeCPanelText = null;this._checkAlterMinSize = null;this._collapse = null;this._collapseEffect = null;this._collectResAreaData = null;this._defineWindowMinDimension = null;this._doCollapse = null;this._doExpand = null;this._expand = null;this._expandEffect = null;this._findDockCellsHor = null;this._findDockCellsVer = null;this._fixIcons = null;this._fixPositionInWin = null;this._fixSize = null;this._fixSplitters = null;this._getNearestParents = null;this._hideCovers = null;this._init = null;this._initWindows = null;this._isCollapsed = null;this._isResizable = null;this._progressControl = null;this._progressControlGlobal = null;this._resizeHor = null;this._resizeStop = null;this._resizeVer = null;this._resAreaData = null;this._setH = null;this._setHeight = null;this._setW = null;this._setWidth = null;this._showCovers = null;this._xmlParser = null;this.attachEvent = null;this.attachMenu = null;this.attachStatusBar = null;this.attachToolbar = null;this.callEvent = null;this.cells = null;this.checkEvent = null;this.detachEvent = null;this.dockWindow = null;this.eventCatcher = null;this.forEachItem = null;this.getEffect = null;this.getIdByIndex = null;this.getIndexById = null;this.getText = null;this.getTextTooltip = null;this.hidePanel = null;this.isPanelVisible = null;this.listAutoSizes = null;this.listViews = null;this.progressOff = null;this.progressOn = null;this.setAutoSize = null;this.setEffect = null;this.setImagePath = null;this.setSizes = null;this.setSkin = null;this.setText = null;this.showPanel = null;this.unDockWindow = null;this.unload = null;this.updateNestedObjectsArray = null;this.setCollapsedText = null;this.attachMenu = null;this.attachToolbar = null;this.attachStatusBar = null;this.detachMenu = null;this.detachToolbar = null;this.detachStatusBar = null;this.showMenu = null;this.showToolbar = null;this.showStatusBar = null;this.hideMenu = null;this.hideToolbar = null;this.hideStatusBar = null;this._cells = null;this._autosize = null;this._effect = null;this._isIPad = null;this.i18n = null;this.dhx_SeverCatcherPath = null;this._autodetectSkin = null;this._doOnDoubleClick = null;this._dblClickTM = null;this._collapsedH = null;this._collapsedW = null;this._minWLAlter = null;this._minWRAlter = null;this._minHBAlter = null;this._minHTAlter = null;this._resXStart = null;this._resYStart = null;this._resXMaxWidthLeft = null;this._resXMaxWidthRight = null;this._resYMaxHeightTop = null;this._resYMaxHeightBottom = null;if (this.obj){this.obj.parentNode.removeChild(this.obj);this.obj = null;}
 
 if (this.base){if (this.base == document.body){}else {this.base.parentNode.removeChild(this.base);this.base = null;}
 }
 
 
 if (this.cont){this.cont.obj._dhxContDestruct();this.cont = null;}
 
 
 
 if (this.dhxWins){this.dhxWins.unload();this.dhxWins = null;this.dhxWinsIdPrefix = null;}
 
 
 if (this._doOnResizeStart){if (_isIE){window.detachEvent("onresize", this._doOnResizeStart);}else {window.removeEventListener("resize", this._doOnResizeStart, false);}
 this._doOnResizeStart = null;this._doOnResizeEnd = null;this._tmTime = null;}
 
 this.detachAllEvents();this.detachAllEvents = null;that = null;}
dhtmlXLayoutObject.prototype.tplData = {"1C": '<layout><autosize hor="a" ver="a" rows="1" cols="1"/><table data="a"/><row><cell obj="a" wh="1,1" resize="ver" neighbors="a"/></row></layout>',
 "2E": '<layout><autosize hor="a;b" ver="b" rows="2" cols="1"/><table data="a;b"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b"/></row><row sep="true"><cell sep="hor" top="a" bottom="b" dblclick="a"/></row><row><cell obj="b" wh="1,2" resize="ver" neighbors="a;b"/></row></layout>',
 "2U": '<layout><autosize hor="b" ver="a;b" rows="1" cols="2"/><table data="a,b"/><row><cell obj="a" wh="2,1" resize="hor" neighbors="a;b"/><cell sep="ver" left="a" right="b"/><cell obj="b" wh="2,1" resize="hor" neighbors="a;b"/></row></layout>',
 
 "3E": '<layout><autosize hor="a;b;c" ver="c" rows="3" cols="1"/><table data="a;b;c"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b;c"/></row><row sep="yes"><cell sep="hor" top="a" bottom="b;c" dblclick="a"/></row><row><cell obj="b" wh="1,3" resize="ver" neighbors="a;b;c"/></row><row sep="yes"><cell sep="hor" top="a;b" bottom="c" dblclick="b"/></row><row><cell obj="c" wh="1,3" resize="ver" neighbors="a;b;c"/></row></layout>',
 "3W": '<layout><autosize hor="c" ver="a;b;c" rows="1" cols="3"/><table data="a,b,c"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a" right="b;c" dblclick="a"/><cell obj="b" wh="3,1" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a;b" right="c" dblclick="b"/><cell obj="c" wh="3,1" resize="hor" neighbors="a;b;c"/></row></layout>',
 "3J": '<layout><autosize hor="b" ver="b;c" rows="2" cols="2"/><table data="a,b;c,b"/><row><cell obj="a" wh="2,2" resize="ver" neighbors="a;c"/><cell sep="ver" left="a,c" right="b" dblclick="b" rowspan="3"/><cell obj="b" wh="2,1" resize="hor" neighbors="a,c;b" rowspan="3"/></row><row sep="yes"><cell sep="hor" top="a" bottom="c" dblclick="a"/></row><row><cell obj="c" wh="2,2" resize="ver" neighbors="a;c"/></row></layout>',
 "3T": '<layout><autosize hor="a;c" ver="b;c" rows="2" cols="2"/><table data="a,a;b,c"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b,c" colspan="3"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c" dblclick="a" colspan="3"/></row><row><cell obj="b" wh="2,2" resize="hor" neighbors="b;c"/><cell sep="ver" left="b" right="c" dblclick="b"/><cell obj="c" wh="2,2" resize="hor" neighbors="b;c"/></row></layout>',
 "3L": '<layout><autosize hor="b;c" ver="a;c" rows="2" cols="2"/><table data="a,b;a,c"/><row><cell obj="a" wh="2,1" resize="hor" neighbors="a;b,c" rowspan="3"/><cell sep="ver" left="a" right="b,c" dblclick="a" rowspan="3"/><cell obj="b" wh="2,2" resize="ver" neighbors="b;c"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c"/></row><row><cell obj="c" wh="b,2" resize="ver" neighbors="b;c"/></row></layout>',
 "3U": '<layout><autosize hor="b;c" ver="c" rows="2" cols="2"/><table data="a,b;c,c"/><row><cell obj="a" wh="2,2" resize="hor" neighbors="a;b"/><cell sep="ver" left="a" right="b" dblclick="a"/><cell obj="b" wh="2,2" resize="hor" neighbors="a;b"/></row><row sep="true"><cell sep="hor" top="a,b" bottom="c" dblclick="c" colspan="3"/></row><row><cell obj="c" wh="1,2" resize="ver" neighbors="a,b;c" colspan="3"/></row></layout>',
 
 "4H": '<layout><autosize hor="d" ver="a;c;d" rows="2" cols="3"/><table data="a,b,d;a,c,d"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b,c;d" rowspan="3"/><cell sep="ver" left="a" right="b,c;d" dblclick="a" rowspan="3"/><cell obj="b" wh="3,2" resize="ver" neighbors="b;c"/><cell sep="ver" left="a;b,c" right="d" dblclick="d" rowspan="3"/><cell obj="d" wh="3,1" resize="hor" neighbors="a;b,c;d" rowspan="3"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c"/></row><row><cell obj="c" wh="3,2" resize="ver" neighbors="b;c"/></row></layout>',
 "4I": '<layout><autosize hor="a;c;d" ver="d" rows="3" cols="2"/><table data="a,a;b,c;d,d"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c;d" colspan="3"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c;d" dblclick="a" colspan="3"/></row><row><cell obj="b" wh="2,3" resize="hor" neighbors="b;c"/><cell sep="ver" left="b" dblclick="b" right="c"/><cell obj="c" wh="2,3" resize="hor" neighbors="b;c"/></row><row sep="true"><cell sep="hor" top="a;b,c" bottom="d" dblclick="d" colspan="3"/></row><row><cell obj="d" wh="1,3" resize="ver" neighbors="a;b,c;d" colspan="3"/></row></layout>',
 "4T": '<layout><autosize hor="a;d" ver="b;c;d" rows="2" cols="3"/><table data="a,a,a;b,c,d"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b,c,d" colspan="5"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c,d" dblclick="a" colspan="5"/></row><row><cell obj="b" wh="3,2" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b" right="c;d" dblclick="b"/><cell obj="c" wh="3,2" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b;c" right="d" dblclick="c"/><cell obj="d" wh="3,2" resize="hor" neighbors="b;c;d"/></row></layout>',
 "4U": '<layout><autosize hor="c;d" ver="d" rows="2" cols="3"/><table data="a,b,c;d,d,d"/><row><cell obj="a" wh="3,2" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a" right="b;c" dblclick="a"/><cell obj="b" wh="3,2" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a;b" right="c" dblclick="b"/><cell obj="c" wh="3,2" resize="hor" neighbors="a;b;c"/></row><row sep="true"><cell sep="hor" top="a,b,c" bottom="d" dblclick="d" colspan="5"/></row><row><cell obj="d" wh="1,2" resize="ver" neighbors="a,b,c;d" colspan="5"/></row></layout>',
 
 "5H": '<layout><autosize hor="b;c;d" ver="a;c;e" rows="3" cols="3"/><table data="a,b,e;a,c,e;a,d,e"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b,c,d" rowspan="5"/><cell sep="ver" left="a" right="b,c,d;e" dblclick="a" rowspan="5"/><cell obj="b" wh="3,3" resize="ver" neighbors="b;c;d"/><cell sep="ver" left="a;b,c,d" right="e" dblclick="e" rowspan="5"/><cell obj="e" wh="3,1" resize="hor" neighbors="b,c,d;e" rowspan="5"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c;d"/></row><row><cell obj="c" wh="3,3" resize="ver" neighbors="b;c;d"/></row><row sep="true"><cell sep="hor" top="b;c" dblclick="c" bottom="d"/></row><row><cell obj="d" wh="3,3" resize="ver" neighbors="b;c;d"/></row></layout>',
 "5I": '<layout><autosize hor="a;d;e" ver="e" rows="3" cols="3"/><table data="a,a,a;b,c,d;e,e,e"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c,d;e" colspan="5"/></row><row sep="match"><cell sep="hor" top="a" bottom="b,c,d;e" dblclick="a" colspan="5"/></row><row><cell obj="b" wh="3,3" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b" right="c;d" dblclick="b"/><cell obj="c" wh="3,3" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b;c" right="d" dblclick="c"/><cell obj="d" wh="3,3" resize="hor" neighbors="b;c;d"/></row><row sep="match"><cell sep="hor" top="a;b,c,d" bottom="e" dblclick="e" colspan="5"/></row><row><cell obj="e" wh="1,3" resize="ver" neighbors="a;b,c,d;e" colspan="5"/></row></layout>',
 
 "6I": '<layout><autosize hor="a;e;f" ver="f" rows="3" cols="4"/><table data="a,a,a,a;b,c,d,e;f,f,f,f"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c,d,e;f" colspan="7"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c,d,e;f" dblclick="a" colspan="7"/></row><row><cell obj="b" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b" right="c;d;e" dblclick="b"/><cell obj="c" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b;c" right="d;e" dblclick="c"/><cell obj="d" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b;c;d" right="e" dblclick="d"/><cell obj="e" wh="4,3" resize="hor" neighbors="b;c;d;e"/></row><row sep="true"><cell sep="hor" top="a;b,c,d,e" bottom="f" dblclick="f" colspan="7"/></row><row><cell obj="f" wh="1,3" resize="ver" neighbors="a;b,c,d,e;f" colspan="7"/></row></layout>'
};dhtmlXLayoutObject.prototype._availAutoSize = {"1C_hor": new Array("a"),
 "1C_ver": new Array("a"),
 "2E_hor": new Array("a;b"),
 "2E_ver": new Array("a", "b"),
 "2U_hor": new Array("a", "b"),
 "2U_ver": new Array("a;b"),
 "3E_hor": new Array("a;b;c"),
 "3E_ver": new Array("a", "b", "c"),
 "3W_hor": new Array("a", "b", "c"),
 "3W_ver": new Array("a;b;c"),
 "3J_hor": new Array("a;c", "b"),
 "3J_ver": new Array("a;b", "c;b"),
 "3T_hor": new Array("a;b", "a;c"),
 "3T_ver": new Array("a", "b;c"),
 "3L_hor": new Array("a", "b;c"),
 "3L_ver": new Array("a;b", "a;c"),
 "3U_hor": new Array("a;c", "b;c"),
 "3U_ver": new Array("a;b", "c"),
 "4H_hor": new Array("a", "b;c", "d"),
 "4H_ver": new Array("a;b;d", "a;c;d"),
 "4I_hor": new Array("a;b;d", "a;c;d"),
 "4I_ver": new Array("a", "b;c", "d"),
 "4T_hor": new Array("a;b", "a;c", "a;d"),
 "4T_ver": new Array("a", "b;c;d"),
 "4U_hor": new Array("a;d", "b;d", "c;d"),
 "4U_ver": new Array("a;b;c", "d"),
 "5H_hor": new Array("a", "b;c;d", "e"),
 "5H_ver": new Array("a;b;e", "a;c;e", "a;d;e"),
 "5I_hor": new Array("a;b;e", "a;c;e", "a;d;e"),
 "5I_ver": new Array("a", "b;c;d", "e"),
 "6I_hor": new Array("a;b;f", "a;c;f", "a;d;f", "a;e;f"),
 "6I_ver": new Array("a", "b;c;d;e", "f")
};dhtmlXLayoutObject.prototype.setCollapsedText = function(cell, text) {if (!this.polyObj[cell])return;var bar = this.polyObj[cell].childNodes[0].childNodes[0];if (bar.childNodes[bar.childNodes.length-1]._ct === true){var p = bar.childNodes[bar.childNodes.length-1];}else {var p = document.createElement("DIV");p._ct = true;p.className = "dhtmlxInfoBarLabel_collapsed_"+this.polyObj[cell]._resize;bar.appendChild(p);}
 p.innerHTML = text;this._fixCollapsedText();bar = null;};dhtmlXLayoutObject.prototype._fixCollapsedText = function() {for (var a in this.polyObj){if (this.polyObj[a]._resize == "hor"){var bar = this.polyObj[a].childNodes[0].childNodes[0];if (bar.childNodes[bar.childNodes.length-1]._ct === true){bar.childNodes[bar.childNodes.length-1].style.width = Math.max(0,bar.offsetHeight-bar.childNodes[4].offsetTop-bar.childNodes[4].offsetHeight-12)+"px";}
 }
 }
}
dhtmlXLayoutObject.prototype.i18n = {dhxcontalert: "dhtmlxcontainer.js is missed on the page",
 collapse: "Collapse",
 expand: "Expand",
 dock: "Dock",
 undock: "UnDock"
};(function(){dhtmlx.extend_api("dhtmlXLayoutObject",{_init:function(obj){return [obj.parent, obj.pattern, obj.skin];},
 image_path:"setImagePath",
 effect:"_effect",
 cells:"_cells",
 autosize:"_autosize"
 },{_cells:function(arr){for (var q=0;q<arr.length;q++){var data = arr[q];var cell = this.cells(data.id);if (cell){if (data.height)cell.setHeight(data.height);if (data.width)cell.setWidth(data.width);if (data.text)cell.setText(data.text);if (data.collapse)cell.collapse();if (data.fix_size)cell.fixSize(data.fix_size[0], data.fix_size[1]);if (data.header === false)cell.hideHeader();}
 }
 },
 _autosize:function(arr){this.setAutoSize(arr[0],arr[1]);},
 _effect:function(data){if (data.collapse)this.setEffect("collapse", data.collapse);if (data.resize)this.setEffect("resize", data.resize);if (data.highlight)this.setEffect("highlight", data.highlight);}
 });})();dhtmlXLayoutObject.prototype.attachHeader = function(obj) {if (this._ha)return;if (typeof(obj)!= "object") obj = document.getElementById(obj);var ofsH = obj.offsetHeight+(this.skin=="dhx_web"?9:2)+2;this.cont.obj._offsetTop = ofsH;this.cont.obj._offsetHeight = -ofsH;this.setSizes();this._ha = document.createElement("DIV");this._ha.style.position = "absolute";this._ha.style.top = "2px";this._ha.style.left = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.left;this._ha.style.width = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.width;this._ha.style.height = obj.offsetHeight+"px";document.body.appendChild(this._ha);this._ha.appendChild(obj);this._haEv = this.attachEvent("onResizeFinish", function(){this._ha.style.width = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.width;});}
dhtmlXLayoutObject.prototype.attachFooter = function(obj) {if (this._fa)return;if (typeof(obj)!= "object") obj = document.getElementById(obj);var ofsH = obj.offsetHeight+(this.skin=="dhx_web"?9:2)-2;this.cont.obj._offsetHeight = this.cont.obj._offsetHeight-ofsH;this.setSizes();this._fa = document.createElement("DIV");this._fa.style.position = "absolute";this._fa.style.bottom = "2px";this._fa.style.left = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.left;this._fa.style.width = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.width;this._fa.style.height = obj.offsetHeight+"px";document.body.appendChild(this._fa);this._fa.appendChild(obj);this._faEv = this.attachEvent("onResizeFinish", function(){this._fa.style.width = this.cont.obj.vs[this.cont.obj.av].dhxcont.style.width;});}
dhtmlXLayoutObject.prototype._fixToolbars = function() {if (!_isIE)return;for (var a in this.polyObj){if (this.polyObj[a].vs[this.polyObj[a].av].toolbar != null)this.polyObj[a].vs[this.polyObj[a].av].toolbar._fixSpacer();}
}
dhtmlXLayoutObject.prototype._hideBorders = function() {if (this.skin != "dhx_terrace")return;this._cpm_old = this.skinParams[this.skin].cell_pading_max;this.skinParams[this.skin].cell_pading_max = [1,0,0,0];for (var a in this.polyObj){this.polyObj[a]._setPadding(this.skinParams[this.skin]["cell_pading_max"], "dhxcont_layout_"+this.skin);this.polyObj[a].adjustContent(this.polyObj[a].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);}
 
}
function dhtmlXMenuObject(baseId, skin) {var main_self = this;this.addBaseIdAsContextZone = null;this.isDhtmlxMenuObject = true;this.skin = (skin != null ? skin : (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : "dhx_skyblue"));this.imagePath = "";this._isIE6 = false;if (_isIE)this._isIE6 = (window.XMLHttpRequest==null?true:false);if (baseId == null){this.base = document.body;}else {var baseObj = (typeof(baseId)=="string"?document.getElementById(baseId):baseId);if (baseObj != null){this.base = baseObj;if (!this.base.id)this.base.id = (new Date()).valueOf();while (this.base.childNodes.length > 0){this.base.removeChild(this.base.childNodes[0]);}
 this.base.className += " dhtmlxMenu_"+this.skin+"_Middle dir_left";this.base._autoSkinUpdate = true;if (this.base.oncontextmenu)this.base._oldContextMenuHandler = this.base.oncontextmenu;this.addBaseIdAsContextZone = this.base.id;this.base.onselectstart = function(e) {e = e || event;e.returnValue = false;return false;}
 this.base.oncontextmenu = function(e) {e = e || event;e.returnValue = false;return false;}
 }else {this.base = document.body;}
 }
 
 this.topId = "dhxWebMenuTopId";if (!this.extendedModule){var t = function(){alert(this.i18n.dhxmenuextalert);};var extMethods = new Array("setItemEnabled", "setItemDisabled", "isItemEnabled", "_changeItemState", "getItemText", "setItemText",
 "loadFromHTML", "hideItem", "showItem", "isItemHidden", "_changeItemVisible", "setUserData", "getUserData",
 "setOpenMode", "setWebModeTimeout", "enableDynamicLoading", "_updateLoaderIcon", "getItemImage", "setItemImage",
 "clearItemImage", "setAutoShowMode", "setAutoHideMode", "setContextMenuHideAllMode", "getContextMenuHideAllMode",
 "setVisibleArea", "setTooltip", "getTooltip", "setHotKey", "getHotKey", "setItemSelected", "setTopText", "setRTL",
 "setAlign", "setHref", "clearHref", "getCircuit", "_clearAllSelectedSubItemsInPolygon", "_checkArrowsState",
 "_addUpArrow", "_addDownArrow", "_removeUpArrow", "_removeDownArrow", "_isArrowExists", "_doScrollUp", "_doScrollDown",
 "_countPolygonItems", "setOverflowHeight", "_getRadioImgObj", "_setRadioState", "_radioOnClickHandler",
 "getRadioChecked", "setRadioChecked", "addRadioButton", "_getCheckboxState", "_setCheckboxState", "_readLevel",
 "_updateCheckboxImage", "_checkboxOnClickHandler", "setCheckboxState", "getCheckboxState", "addCheckbox", "serialize");for (var q=0;q<extMethods.length;q++)if (!this[extMethods[q]])this[extMethods[q]] = t;extMethods = null;}
 
 
 this.fixedPosition = false;this.menuSelected = -1;this.menuLastClicked = -1;this.idPrefix = "";this.itemTagName = "item";this.itemTextTagName = "itemtext";this.userDataTagName = "userdata";this.itemTipTagName = "tooltip";this.itemHotKeyTagName = "hotkey";this.itemHrefTagName = "href";this.dirTopLevel = "bottom";this.dirSubLevel = "right";this.menuX1 = null;this.menuX2 = null;this.menuY1 = null;this.menuY2 = null;this.menuMode = "web";this.menuTimeoutMsec = 400;this.menuTimeoutHandler = null;this.autoOverflow = false;this.idPull = {};this.itemPull = {};this.userData = {};this.radio = {};this._rtl = false;this._align = "left";this.menuTouched = false;this.zIndInit = 1200;this.zInd = this.zIndInit;this.zIndStep = 50;this.menuModeTopLevelTimeout = true;this.menuModeTopLevelTimeoutTime = 200;this._topLevelBottomMargin = 1;this._topLevelRightMargin = 0;this._topLevelOffsetLeft = 1;this._arrowFFFix = (_isIE?(document.compatMode=="BackCompat"?0:-4):-4);this.setSkin = function(skin) {var oldSkin = this.skin;this.skin = skin;switch (this.skin){case "dhx_black":
 case "dhx_blue":
 case "dhx_skyblue":
 case "dhx_web":
 this._topLevelBottomMargin = 2;this._topLevelRightMargin = 1;this._topLevelOffsetLeft = 1;this._arrowFFFix = (_isIE?(document.compatMode=="BackCompat"?0:-4):-4);break;case "dhx_web":
 this._arrowFFFix = 0;break;case "dhx_terrace":
 this._topLevelBottomMargin = 0;this._topLevelRightMargin = 0;this._topLevelOffsetLeft = 0;this._arrowFFFix = (_isIE?(document.compatMode=="BackCompat"?0:-4):-4);break;}
 if (this.base._autoSkinUpdate){this.base.className = this.base.className.replace("dhtmlxMenu_"+oldSkin+"_Middle", "")+" dhtmlxMenu_"+this.skin+"_Middle";}
 
 for (var a in this.idPull){this.idPull[a].className = String(this.idPull[a].className).replace(oldSkin, this.skin);}
 }
 this.setSkin(this.skin);this.dLoad = false;this.dLoadUrl = "";this.dLoadSign = "?";this.loaderIcon = false;this.limit = 0;this._scrollUpTM = null;this._scrollUpTMTime = 20;this._scrollUpTMStep = 3;this._scrollDownTM = null;this._scrollDownTMTime = 20;this._scrollDownTMStep = 3;this.context = false;this.contextZones = {};this.contextMenuZoneId = false;this.contextAutoShow = true;this.contextAutoHide = true;this.contextHideAllMode = true;this._selectedSubItems = new Array();this._openedPolygons = new Array();this._addSubItemToSelected = function(item, polygon) {var t = true;for (var q=0;q<this._selectedSubItems.length;q++){if ((this._selectedSubItems[q][0] == item)&& (this._selectedSubItems[q][1] == polygon)) {t = false;}}
 if (t == true){this._selectedSubItems.push(new Array(item, polygon));}
 return t;}
 this._removeSubItemFromSelected = function(item, polygon) {var m = new Array();var t = false;for (var q=0;q<this._selectedSubItems.length;q++){if ((this._selectedSubItems[q][0] == item)&& (this._selectedSubItems[q][1] == polygon)) {t = true;}else {m[m.length] = this._selectedSubItems[q];}}
 if (t == true){this._selectedSubItems = m;}
 return t;}
 this._getSubItemToDeselectByPolygon = function(polygon) {var m = new Array();for (var q=0;q<this._selectedSubItems.length;q++){if (this._selectedSubItems[q][1] == polygon){m[m.length] = this._selectedSubItems[q][0];m = m.concat(this._getSubItemToDeselectByPolygon(this._selectedSubItems[q][0]));var t = true;for (var w=0;w<this._openedPolygons.length;w++){if (this._openedPolygons[w] == this._selectedSubItems[q][0]){t = false;}}
 if (t == true){this._openedPolygons[this._openedPolygons.length] = this._selectedSubItems[q][0];}
 this._selectedSubItems[q][0] = -1;this._selectedSubItems[q][1] = -1;}
 }
 return m;}
 
 
 this._hidePolygon = function(id) {if (this.idPull["polygon_" + id] != null){if (typeof(this._menuEffect)!= "undefined" && this._menuEffect !== false) {this._hidePolygonEffect("polygon_"+id);}else {if (this.idPull["polygon_"+id].style.display == "none")return;this.idPull["polygon_"+id].style.display = "none";if (this.idPull["arrowup_"+id] != null){this.idPull["arrowup_"+id].style.display = "none";}
 if (this.idPull["arrowdown_"+id] != null){this.idPull["arrowdown_"+id].style.display = "none";}
 this._updateItemComplexState(id, true, false);if (this._isIE6){if (this.idPull["polygon_"+id+"_ie6cover"] != null){this.idPull["polygon_"+id+"_ie6cover"].style.display = "none";}}
 }
 
 id = String(id).replace(this.idPrefix, "");if (id == this.topId)id = null;this.callEvent("onHide", [id]);if (id != null && this.skin == "dhx_terrace" && this.itemPull[this.idPrefix+id].parent == this.idPrefix+this.topId){this._improveTerraceButton(this.idPrefix+id, true);}
 
 
 }
 }
 this._showPolygon = function(id, openType) {var itemCount = this._countVisiblePolygonItems(id);if (itemCount == 0)return;var pId = "polygon_"+id;if ((this.idPull[pId] != null)&& (this.idPull[id] != null)) {if (this.menuModeTopLevelTimeout && this.menuMode == "web" && !this.context){if (!this.idPull[id]._mouseOver && openType == this.dirTopLevel)return;}
 
 
 if (!this.fixedPosition)this._autoDetectVisibleArea();var arrUpH = 0;var arrDownH = 0;var arrowUp = null;var arrowDown = null;this.idPull[pId].style.visibility = "hidden";this.idPull[pId].style.left = "0px";this.idPull[pId].style.top = "0px";this.idPull[pId].style.display = "";this.idPull[pId].style.zIndex = this.zInd;if (this.autoOverflow){if (this.idPull[pId].firstChild.offsetHeight > this.menuY1+this.menuY2){var t0 = Math.floor((this.menuY2-this.menuY1-35)/24);this.limit = t0;}else {this.limit = 0;if (this.idPull["arrowup_"+id] != null)this._removeUpArrow(String(id).replace(this.idPrefix,""));if (this.idPull["arrowdown_"+id] != null)this._removeDownArrow(String(id).replace(this.idPrefix,""));}
 }
 
 
 if (this.limit > 0 && this.limit < itemCount){if (this.idPull["arrowup_"+id] == null)this._addUpArrow(String(id).replace(this.idPrefix,""));if (this.idPull["arrowdown_"+id] == null)this._addDownArrow(String(id).replace(this.idPrefix,""));arrowUp = this.idPull["arrowup_"+id];arrowUp.style.visibility = "hidden";arrowUp.style.display = "";arrowUp.style.zIndex = this.zInd;arrUpH = arrowUp.offsetHeight;arrowDown = this.idPull["arrowdown_"+id];arrowDown.style.visibility = "hidden";arrowDown.style.display = "";arrowDown.style.zIndex = this.zInd;arrDownH = arrowDown.offsetHeight;}
 
 
 if (this.limit > 0){if (this.limit < itemCount){this.idPull[pId].style.height = 24*this.limit+"px";this.idPull[pId].scrollTop = 0;}else {this.idPull[pId].style.height = "";}
 }
 
 this.zInd += this.zIndStep;if (this.itemPull[id] != null){var parPoly = "polygon_"+this.itemPull[id]["parent"];}else if (this.context){var parPoly = this.idPull[this.idPrefix+this.topId];}
 
 
 
 
 var srcX = (this.idPull[id].tagName != null ? getAbsoluteLeft(this.idPull[id]) : this.idPull[id][0]);var srcY = (this.idPull[id].tagName != null ? getAbsoluteTop(this.idPull[id]) : this.idPull[id][1]);var srcW = (this.idPull[id].tagName != null ? this.idPull[id].offsetWidth : 0);var srcH = (this.idPull[id].tagName != null ? this.idPull[id].offsetHeight : 0);var x = 0;var y = 0;var w = this.idPull[pId].offsetWidth;var h = this.idPull[pId].offsetHeight + arrUpH + arrDownH;if (openType == "bottom"){if (this._rtl){x = srcX + (srcW!=null?srcW:0) - w;}else {if (this._align == "right"){x = srcX + srcW - w;}else {x = srcX - 1 + (openType==this.dirTopLevel?this._topLevelRightMargin:0);}
 }
 y = srcY - 1 + srcH + this._topLevelBottomMargin;}
 if (openType == "right"){x = srcX + srcW - 1;y = srcY + 2;}
 if (openType == "left"){x = srcX - this.idPull[pId].offsetWidth + 2;y = srcY + 2;}
 if (openType == "top"){x = srcX - 1;y = srcY - h + 2;}
 
 
 if (this.fixedPosition){var mx = 65536;var my = 65536;}else {var mx = (this.menuX2!=null?this.menuX2:0);var my = (this.menuY2!=null?this.menuY2:0);if (mx == 0){if (window.innerWidth){mx = window.innerWidth;my = window.innerHeight;}else {mx = document.body.offsetWidth;my = document.body.scrollHeight;}
 }
 }
 if (x+w > mx && !this._rtl){x = srcX - w + 2;}
 if (x < this.menuX1 && this._rtl){x = srcX + srcW - 2;}
 if (x < 0){x = 0;}
 if (y+h > my && this.menuY2 != null){y = Math.max(srcY + srcH - h + 2, (this._isVisibleArea?this.menuY1+2:2));if (this.context && this.idPrefix+this.topId == id && arrowDown != null){y = y-2;}
 if (this.itemPull[id] != null && !this.context){if (this.itemPull[id]["parent"] == this.idPrefix+this.topId)y = y - this.base.offsetHeight;}
 }
 
 this.idPull[pId].style.left = x+"px";this.idPull[pId].style.top = y+arrUpH+"px";if (typeof(this._menuEffect)!= "undefined" && this._menuEffect !== false) {this._showPolygonEffect(pId);}else {this.idPull[pId].style.visibility = "";if (this.limit > 0 && this.limit < itemCount){arrowUp.style.left = x+"px";arrowUp.style.top = y+"px";arrowUp.style.width = w+this._arrowFFFix+"px";arrowUp.style.visibility = "";arrowDown.style.left = x+"px";arrowDown.style.top = y+h-arrDownH+"px";arrowDown.style.width = w+this._arrowFFFix+"px";arrowDown.style.visibility = "";this._checkArrowsState(id);}
 
 
 if (this._isIE6){var pIdIE6 = pId+"_ie6cover";if (this.idPull[pIdIE6] == null){var ifr = document.createElement("IFRAME");ifr.className = "dhtmlxMenu_IE6CoverFix_"+this.skin;ifr.frameBorder = 0;ifr.setAttribute("src", "javascript:false;");document.body.insertBefore(ifr, document.body.firstChild);this.idPull[pIdIE6] = ifr;}
 this.idPull[pIdIE6].style.left = x+"px";this.idPull[pIdIE6].style.top = y+"px";this.idPull[pIdIE6].style.width = w+"px";this.idPull[pIdIE6].style.height = h+"px";this.idPull[pIdIE6].style.zIndex = this.idPull[pId].style.zIndex-1;this.idPull[pIdIE6].style.display = "";}
 }
 
 id = String(id).replace(this.idPrefix, "");if (id == this.topId)id = null;this.callEvent("onShow", [id]);if (id != null && this.skin == "dhx_terrace" && this.itemPull[this.idPrefix+id].parent == this.idPrefix+this.topId){this._improveTerraceButton(this.idPrefix+id, false);}
 
 
 }
 }
 
 this._redistribSubLevelSelection = function(id, parentId) {while (this._openedPolygons.length > 0)this._openedPolygons.pop();var i = this._getSubItemToDeselectByPolygon(parentId);this._removeSubItemFromSelected(-1, -1);for (var q=0;q<i.length;q++){if ((this.idPull[i[q]] != null)&& (i[q] != id)) {if (this.itemPull[i[q]]["state"] == "enabled"){this.idPull[i[q]].className = "sub_item";}}}
 
 for (var q=0;q<this._openedPolygons.length;q++){if (this._openedPolygons[q] != parentId){this._hidePolygon(this._openedPolygons[q]);}}
 
 if (this.itemPull[id]["state"] == "enabled"){this.idPull[id].className = "sub_item_selected";if (this.itemPull[id]["complex"] && this.dLoad && (this.itemPull[id]["loaded"]=="no")) {if (this.loaderIcon == true){this._updateLoaderIcon(id, true);}
 var xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this.itemPull[id]["loaded"] = "get";this.callEvent("onXLS", []);xmlLoader.loadXML(this.dLoadUrl+this.dLoadSign+"action=loadMenu&parentId="+id.replace(this.idPrefix,"")+"&etc="+new Date().getTime());}
 
 if (this.itemPull[id]["complex"] || (this.dLoad && (this.itemPull[id]["loaded"] == "yes"))) {if ((this.itemPull[id]["complex"])&& (this.idPull["polygon_" + id] != null)) {this._updateItemComplexState(id, true, true);this._showPolygon(id, this.dirSubLevel);}
 }
 this._addSubItemToSelected(id, parentId);this.menuSelected = id;}
 }
 
 this._doOnClick = function(id, type, casState) {this.menuLastClicked = id;if (this.itemPull[this.idPrefix+id]["href_link"] != null && this.itemPull[this.idPrefix+id].state == "enabled"){var form = document.createElement("FORM");var k = String(this.itemPull[this.idPrefix+id]["href_link"]).split("?");form.action = k[0];if (k[1] != null){var p = String(k[1]).split("&");for (var q=0;q<p.length;q++){var j = String(p[q]).split("=");var m = document.createElement("INPUT");m.type = "hidden";m.name = (j[0]||"");m.value = (j[1]||"");form.appendChild(m);}
 }
 if (this.itemPull[this.idPrefix+id]["href_target"] != null){form.target = this.itemPull[this.idPrefix+id]["href_target"];}
 form.style.display = "none";document.body.appendChild(form);form.submit();if (form != null){document.body.removeChild(form);form = null;}
 return;}
 
 
 if (type.charAt(0)=="c") return;if (type.charAt(1)=="d") return;if (type.charAt(2)=="s") return;if (this.checkEvent("onClick")) {this.callEvent("onClick", [id, this.contextMenuZoneId, casState]);}else {if ((type.charAt(1)== "d") || (this.menuMode == "win" && type.charAt(2) == "t")) return;}
 if (this.context && this._isContextMenuVisible()&& this.contextAutoHide) {this._hideContextMenu();}else {if (this._clearAndHide)this._clearAndHide();}
 }
 
 this._doOnTouchMenu = function(id) {if (this.menuTouched == false){this.menuTouched = true;if (this.checkEvent("onTouch")) {this.callEvent("onTouch", [id]);}
 }
 }
 
 
 
 this._searchMenuNode = function(node, menu) {var m = new Array();for (var q=0;q<menu.length;q++){if (typeof(menu[q])== "object") {if (menu[q].length == 5){if (typeof(menu[q][0])!= "object") {if ((menu[q][0].replace(this.idPrefix, "")== node) && (q == 0)) {m = menu;}}}
 var j = this._searchMenuNode(node, menu[q]);if (j.length > 0){m = j;}
 }
 }
 return m;}
 
 
 this._getMenuNodes = function(node) {var m = new Array;for (var a in this.itemPull){if (this.itemPull[a]["parent"] == node){m[m.length] = a;}}
 return m;}
 
 this._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 
 this.getItemType = function(id) {id = this.idPrefix+id;if (this.itemPull[id] == null){return null;}
 return this.itemPull[id]["type"];}
 
 this.forEachItem = function(handler) {for (var a in this.itemPull){handler(String(a).replace(this.idPrefix, ""));}
 }
 
 this._clearAndHide = function() {main_self.menuSelected = -1;main_self.menuLastClicked = -1;while (main_self._openedPolygons.length > 0){main_self._openedPolygons.pop();}
 for (var q=0;q<main_self._selectedSubItems.length;q++){var id = main_self._selectedSubItems[q][0];if (main_self.idPull[id] != null){if (main_self.itemPull[id]["state"] == "enabled"){if (main_self.idPull[id].className == "sub_item_selected")main_self.idPull[id].className = "sub_item";if (main_self.idPull[id].className == "dhtmlxMenu_"+main_self.skin+"_TopLevel_Item_Selected"){if (main_self.itemPull[id]["cssNormal"] != null){main_self.idPull[id].className = main_self.itemPull[id]["cssNormal"];}else {main_self.idPull[id].className = "dhtmlxMenu_"+main_self.skin+"_TopLevel_Item_Normal";}
 }
 }
 }
 main_self._hidePolygon(id);}
 
 
 main_self.menuTouched = false;if (main_self.context){if (main_self.contextHideAllMode){main_self._hidePolygon(main_self.idPrefix+main_self.topId);main_self.zInd = main_self.zIndInit;}else {main_self.zInd = main_self.zIndInit+main_self.zIndStep;}
 }
 }
 
 this._doOnLoad = function() {}
 
 this.loadXML = function(xmlFile, onLoadFunction) {if (onLoadFunction)this._doOnLoad = function() {onLoadFunction();};this.callEvent("onXLS", []);this._xmlLoader.loadXML(xmlFile);}
 
 this.loadXMLString = function(xmlString, onLoadFunction) {if (onLoadFunction)this._doOnLoad = function() {onLoadFunction();};this._xmlLoader.loadXMLString(xmlString);}
 this._buildMenu = function(t, parentId) {var u = 0;for (var q=0;q<t.childNodes.length;q++){if (t.childNodes[q].tagName == this.itemTagName){var r = t.childNodes[q];var item = {};item["id"] = this.idPrefix+(r.getAttribute("id")||this._genStr(24));item["title"] = r.getAttribute("text")||"";item["imgen"] = r.getAttribute("img")||"";item["imgdis"] = r.getAttribute("imgdis")||"";item["tip"] = "";item["hotkey"] = "";if (r.getAttribute("cssNormal")!= null) {item["cssNormal"] = r.getAttribute("cssNormal");}
 
 item["type"] = r.getAttribute("type")||"item";if (item["type"] == "checkbox"){item["checked"] = (r.getAttribute("checked")!=null);item["imgen"] = "chbx_"+(item["checked"]?"1":"0");item["imgdis"] = item["imgen"];}
 if (item["type"] == "radio"){item["checked"] = (r.getAttribute("checked")!=null);item["imgen"] = "rdbt_"+(item["checked"]?"1":"0");item["imgdis"] = item["imgen"];item["group"] = r.getAttribute("group")||this._genStr(24);if (this.radio[item["group"]]==null){this.radio[item["group"]] = new Array();}
 this.radio[item["group"]][this.radio[item["group"]].length] = item["id"];}
 
 item["state"] = (r.getAttribute("enabled")!=null||r.getAttribute("disabled")!=null?(r.getAttribute("enabled")=="false"||r.getAttribute("disabled")=="true"?"disabled":"enabled"):"enabled");item["parent"] = (parentId!=null?parentId:this.idPrefix+this.topId);item["complex"] = (this.dLoad?(r.getAttribute("complex")!=null?true:false):(this._buildMenu(r,item["id"])>0));if (this.dLoad && item["complex"]){item["loaded"] = "no";}
 this.itemPull[item["id"]] = item;for (var w=0;w<r.childNodes.length;w++){var tagNm = r.childNodes[w].tagName;if (tagNm != null){tagNm = tagNm.toLowerCase();}
 
 if (tagNm == this.userDataTagName){var d = r.childNodes[w];if (d.getAttribute("name")!=null) {this.userData[item["id"]+"_"+d.getAttribute("name")] = (d.firstChild!=null&&d.firstChild.nodeValue!=null?d.firstChild.nodeValue:"");}
 }
 
 if (tagNm == this.itemTextTagName){item["title"] = r.childNodes[w].firstChild.nodeValue;}
 
 if (tagNm == this.itemTipTagName){item["tip"] = r.childNodes[w].firstChild.nodeValue;}
 
 if (tagNm == this.itemHotKeyTagName){item["hotkey"] = r.childNodes[w].firstChild.nodeValue;}
 
 if (tagNm == this.itemHrefTagName && item["type"] == "item"){item["href_link"] = r.childNodes[w].firstChild.nodeValue;if (r.childNodes[w].getAttribute("target")!= null) {item["href_target"] = r.childNodes[w].getAttribute("target");}
 }
 }
 u++;}
 }
 return u;}
 
 this._xmlParser = function() {if (main_self.dLoad){var t = this.getXMLTopNode("menu");parentId = (t.getAttribute("parentId")!=null?t.getAttribute("parentId"):null);if (parentId == null){main_self._buildMenu(t, null);main_self._initTopLevelMenu();}else {main_self._buildMenu(t, main_self.idPrefix+parentId);main_self._addSubMenuPolygon(main_self.idPrefix+parentId, main_self.idPrefix+parentId);if (main_self.menuSelected == main_self.idPrefix+parentId){var pId = main_self.idPrefix+parentId;var isTop = main_self.itemPull[main_self.idPrefix+parentId]["parent"]==main_self.idPrefix+main_self.topId;var level = ((isTop&&(!main_self.context))?main_self.dirTopLevel:main_self.dirSubLevel);var isShow = false;if (isTop && main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context){var item = main_self.idPull[main_self.idPrefix+parentId];if (item._mouseOver == true){var delay = main_self.menuModeTopLevelTimeoutTime - (new Date().getTime()-item._dynLoadTM);if (delay > 1){item._menuOpenTM = window.setTimeout(function(){main_self._showPolygon(pId, level);}, delay);isShow = true;}
 }
 }
 if (!isShow){main_self._showPolygon(pId, level);}
 }
 main_self.itemPull[main_self.idPrefix+parentId]["loaded"] = "yes";if (main_self.loaderIcon == true){main_self._updateLoaderIcon(main_self.idPrefix+parentId, false);}
 }
 this.destructor();main_self.callEvent("onXLE",[]);}else {var t = this.getXMLTopNode("menu");main_self._buildMenu(t, null);main_self.init();main_self.callEvent("onXLE",[]);main_self._doOnLoad();}
 }
 this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this._showSubLevelItem = function(id,back) {if (document.getElementById("arrow_" + this.idPrefix + id)!= null) {document.getElementById("arrow_" + this.idPrefix + id).style.display = (back?"none":"");}
 if (document.getElementById("image_" + this.idPrefix + id)!= null) {document.getElementById("image_" + this.idPrefix + id).style.display = (back?"none":"");}
 if (document.getElementById(this.idPrefix + id)!= null) {document.getElementById(this.idPrefix + id).style.display = (back?"":"none");}
 }
 
 this._hideSubLevelItem = function(id) {this._showSubLevelItem(id,true)
 }
 
 this.idPrefix = this._genStr(12);this._bodyClick = function(e) {e = e||event;if (e.button == 2 || (_isOpera && e.ctrlKey == true)) return;if (main_self.context){if (main_self.contextAutoHide && (!_isOpera || (main_self._isContextMenuVisible()&& _isOpera))) main_self._hideContextMenu();}else {if (main_self._clearAndHide)main_self._clearAndHide();}
 }
 this._bodyContext = function(e) {e = e||event;var t = (e.srcElement||e.target).className;if (t.search("dhtmlxMenu")!= -1 && t.search("SubLevelArea") != -1) return;var toHide = true;var testZone = e.target || e.srcElement;while (testZone != null){if (testZone.id != null)if (main_self.isContextZone(testZone.id)) toHide = false;if (testZone == document.body)toHide = false;testZone = testZone.parentNode;}
 if (toHide)main_self.hideContextMenu();}
 
 if (_isIE){document.body.attachEvent("onclick", this._bodyClick);document.body.attachEvent("oncontextmenu", this._bodyContext);}else {window.addEventListener("click", this._bodyClick, false);window.addEventListener("contextmenu", this._bodyContext, false);}
 
 
 this._UID = this._genStr(32);dhtmlxMenuObjectLiveInstances[this._UID] = this;dhtmlxEventable(this);return this;}
dhtmlXMenuObject.prototype.init = function() {if (this._isInited == true)return;if (this.dLoad){this.callEvent("onXLS", []);this._xmlLoader.loadXML(this.dLoadUrl+this.dLoadSign+"action=loadMenu&etc="+new Date().getTime());}else {this._initTopLevelMenu();this._isInited = true;}
}
dhtmlXMenuObject.prototype._countVisiblePolygonItems = function(id) {var count = 0;for (var a in this.itemPull){var par = this.itemPull[a]["parent"];var tp = this.itemPull[a]["type"];if (this.idPull[a] != null){if (par == id && (tp == "item" || tp == "radio" || tp == "checkbox")&& this.idPull[a].style.display != "none") {count++;}
 }
 }
 return count;}
dhtmlXMenuObject.prototype._redefineComplexState = function(id) {if (this.idPrefix+this.topId == id){return;}
 if ((this.idPull["polygon_"+id] != null)&& (this.idPull[id] != null)) {var u = this._countVisiblePolygonItems(id);if ((u > 0)&& (!this.itemPull[id]["complex"])) {this._updateItemComplexState(id, true, false);}
 if ((u == 0)&& (this.itemPull[id]["complex"])) {this._updateItemComplexState(id, false, false);}
 }
}
dhtmlXMenuObject.prototype._updateItemComplexState = function(id, state, over) {if ((!this.context)&& (this._getItemLevelType(id.replace(this.idPrefix,"")) == "TopLevel")) {this.itemPull[id]["complex"] = state;return;}
 if ((this.idPull[id] == null)|| (this.itemPull[id] == null)) {return;}
 
 this.itemPull[id]["complex"] = state;if (id == this.idPrefix+this.topId)return;var arrowObj = null;var item = this.idPull[id].childNodes[this._rtl?0:2];if (item.childNodes[0])if (String(item.childNodes[0].className).search("complex_arrow") === 0) arrowObj = item.childNodes[0];if (this.itemPull[id]["complex"]){if (arrowObj == null){arrowObj = document.createElement("DIV");arrowObj.className = "complex_arrow";arrowObj.id = "arrow_"+id;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.appendChild(arrowObj);}
 
 
 if (this.dLoad && (this.itemPull[id]["loaded"] == "get")&& this.loaderIcon) {if (arrowObj.className != "complex_arrow_loading")arrowObj.className = "complex_arrow_loading";}else {arrowObj.className = "complex_arrow";}
 
 return;}
 
 if ((!this.itemPull[id]["complex"])&& (arrowObj!=null)) {item.removeChild(arrowObj);if (this.itemPull[id]["hotkey_backup"] != null && this.setHotKey){this.setHotKey(id.replace(this.idPrefix, ""), this.itemPull[id]["hotkey_backup"]);}
 }
 
}
dhtmlXMenuObject.prototype._getItemLevelType = function(id) {return (this.itemPull[this.idPrefix+id]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea");}
dhtmlXMenuObject.prototype._redistribTopLevelSelection = function(id, parent) {var i = this._getSubItemToDeselectByPolygon("parent");this._removeSubItemFromSelected(-1, -1);for (var q=0;q<i.length;q++){if (i[q] != id){this._hidePolygon(i[q]);}
 if ((this.idPull[i[q]] != null)&& (i[q] != id)) {this.idPull[i[q]].className = this.idPull[i[q]].className.replace(/Selected/g, "Normal");}
 }
 
 if (this.itemPull[this.idPrefix+id]["state"] == "enabled"){this.idPull[this.idPrefix+id].className = "dhtmlxMenu_"+this.skin+"_TopLevel_Item_Selected";this._addSubItemToSelected(this.idPrefix+id, "parent");this.menuSelected = (this.menuMode=="win"?(this.menuSelected!=-1?id:this.menuSelected):id);if ((this.itemPull[this.idPrefix+id]["complex"])&& (this.menuSelected != -1)) {this._showPolygon(this.idPrefix+id, this.dirTopLevel);}
 }
}
dhtmlXMenuObject.prototype._initTopLevelMenu = function() {this.dirTopLevel = "bottom";this.dirSubLevel = (this._rtl?"left":"right");if (this.context){this.idPull[this.idPrefix+this.topId] = new Array(0,0);this._addSubMenuPolygon(this.idPrefix+this.topId, this.idPrefix+this.topId);}else {var m = this._getMenuNodes(this.idPrefix + this.topId);for (var q=0;q<m.length;q++){if (this.itemPull[m[q]]["type"] == "item")this._renderToplevelItem(m[q], null);if (this.itemPull[m[q]]["type"] == "separator")this._renderSeparator(m[q], null);}
 }
}
dhtmlXMenuObject.prototype._renderToplevelItem = function(id, pos) {var main_self = this;var m = document.createElement("DIV");m.id = id;if (this.itemPull[id]["state"] == "enabled" && this.itemPull[id]["cssNormal"] != null){m.className = this.itemPull[id]["cssNormal"];}else {m.className = "dhtmlxMenu_"+this.skin+"_TopLevel_Item_"+(this.itemPull[id]["state"]=="enabled"?"Normal":"Disabled");}
 
 
 if (this.itemPull[id]["title"] != ""){var t1 = document.createElement("DIV");t1.className = "top_level_text";t1.innerHTML = this.itemPull[id]["title"];m.appendChild(t1);}
 
 if (this.itemPull[id]["tip"].length > 0)m.title = this.itemPull[id]["tip"];if ((this.itemPull[id]["imgen"]!="")||(this.itemPull[id]["imgdis"]!="")) {var imgTop=this.itemPull[id][(this.itemPull[id]["state"]=="enabled")?"imgen":"imgdis"];if (imgTop){var img = document.createElement("IMG");img.border = "0";img.id = "image_"+id;img.src= this.imagePath+imgTop;img.className = "dhtmlxMenu_TopLevel_Item_Icon";if (m.childNodes.length > 0 && !this._rtl)m.insertBefore(img, m.childNodes[0]);else m.appendChild(img);}
 }
 m.onselectstart = function(e) {e = e || event;e.returnValue = false;return false;}
 m.oncontextmenu = function(e) {e = e || event;e.returnValue = false;return false;}
 
 if (!this.cont){this.cont = document.createElement("DIV");this.cont.dir = "ltr";this.cont.className = (this._align=="right"?"align_right":"align_left");this.base.appendChild(this.cont);}
 
 
 if (pos != null){pos++;if (pos < 0)pos = 0;if (pos > this.cont.childNodes.length - 1)pos = null;}
 if (pos != null)this.cont.insertBefore(m, this.cont.childNodes[pos]);else this.cont.appendChild(m);this.idPull[m.id] = m;if (this.itemPull[id]["complex"] && (!this.dLoad)) this._addSubMenuPolygon(this.itemPull[id]["id"], this.itemPull[id]["id"]);m.onmouseover = function() {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);}
 
 var i = main_self._getSubItemToDeselectByPolygon("parent");main_self._removeSubItemFromSelected(-1, -1);for (var q=0;q<i.length;q++){if (i[q] != this.id){main_self._hidePolygon(i[q]);}
 if ((main_self.idPull[i[q]] != null)&& (i[q] != this.id)) {if (main_self.itemPull[i[q]]["cssNormal"] != null){main_self.idPull[i[q]].className = main_self.itemPull[i[q]]["cssNormal"];}else {if (main_self.idPull[i[q]].className == "sub_item_selected")main_self.idPull[i[q]].className = "sub_item";main_self.idPull[i[q]].className = main_self.idPull[i[q]].className.replace(/Selected/g, "Normal");}
 }
 }
 
 if (main_self.itemPull[this.id]["state"] == "enabled"){this.className = "dhtmlxMenu_"+main_self.skin+"_TopLevel_Item_Selected";main_self._addSubItemToSelected(this.id, "parent");main_self.menuSelected = (main_self.menuMode=="win"?(main_self.menuSelected!=-1?this.id:main_self.menuSelected):this.id);if (main_self.dLoad && (main_self.itemPull[this.id]["loaded"]=="no")) {if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context){this._mouseOver = true;this._dynLoadTM = new Date().getTime();}
 var xmlLoader = new dtmlXMLLoaderObject(main_self._xmlParser, window);main_self.itemPull[this.id]["loaded"] = "get";main_self.callEvent("onXLS", []);xmlLoader.loadXML(main_self.dLoadUrl+main_self.dLoadSign+"action=loadMenu&parentId="+this.id.replace(main_self.idPrefix,"")+"&etc="+new Date().getTime());}
 if ((!main_self.dLoad)|| (main_self.dLoad && (!main_self.itemPull[this.id]["loaded"] || main_self.itemPull[this.id]["loaded"]=="yes"))) {if ((main_self.itemPull[this.id]["complex"])&& (main_self.menuSelected != -1)) {if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context){this._mouseOver = true;var showItemId = this.id;this._menuOpenTM = window.setTimeout(function(){main_self._showPolygon(showItemId, main_self.dirTopLevel);}, main_self.menuModeTopLevelTimeoutTime);}else {main_self._showPolygon(this.id, main_self.dirTopLevel);}
 }
 }
 }
 main_self._doOnTouchMenu(this.id.replace(main_self.idPrefix, ""));}
 m.onmouseout = function() {if (!((main_self.itemPull[this.id]["complex"])&& (main_self.menuSelected != -1)) && (main_self.itemPull[this.id]["state"]=="enabled")) {if (main_self.itemPull[this.id]["cssNormal"] != null){m.className = main_self.itemPull[this.id]["cssNormal"];}else {m.className = "dhtmlxMenu_"+main_self.skin+"_TopLevel_Item_Normal";}
 }
 if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);main_self.menuTimeoutHandler = window.setTimeout(function(){main_self._clearAndHide();}, main_self.menuTimeoutMsec, "JavaScript");}
 if (main_self.menuModeTopLevelTimeout && main_self.menuMode == "web" && !main_self.context){this._mouseOver = false;window.clearTimeout(this._menuOpenTM);}
 }
 m.onclick = function(e) {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);}
 
 if (main_self.menuMode != "web" && main_self.itemPull[this.id]["state"] == "disabled"){return;}
 
 e = e || event;e.cancelBubble = true;e.returnValue = false;if (main_self.menuMode == "win"){if (main_self.itemPull[this.id]["complex"]){if (main_self.menuSelected == this.id){main_self.menuSelected = -1;var s = false;}else {main_self.menuSelected = this.id;var s = true;}
 if (s){main_self._showPolygon(this.id, main_self.dirTopLevel);}else {main_self._hidePolygon(this.id);}
 }
 }
 var tc = (main_self.itemPull[this.id]["complex"]?"c":"-");var td = (main_self.itemPull[this.id]["state"]!="enabled"?"d":"-");var cas = {"ctrl": e.ctrlKey, "alt": e.altKey, "shift": e.shiftKey};main_self._doOnClick(this.id.replace(main_self.idPrefix, ""), tc+td+"t", cas);return false;}
 
 if (this.skin == "dhx_terrace"){this._improveTerraceSkin();}
}
dhtmlXMenuObject.prototype.setImagePath = function() {}
dhtmlXMenuObject.prototype.setIconsPath = function(path) {this.imagePath = path;}
dhtmlXMenuObject.prototype.setIconPath = dhtmlXMenuObject.prototype.setIconsPath;dhtmlXMenuObject.prototype._updateItemImage = function(id, levelType) {id = this.idPrefix+id;var isTopLevel = (this.itemPull[id]["parent"] == this.idPrefix+this.topId && !this.context);var imgObj = null;if (isTopLevel){for (var q=0;q<this.idPull[id].childNodes.length;q++){try {if (this.idPull[id].childNodes[q].className == "dhtmlxMenu_TopLevel_Item_Icon")imgObj = this.idPull[id].childNodes[q];}catch(e) {}
 }
 }else {try {var imgObj = this.idPull[id].childNodes[this._rtl?2:0].childNodes[0];}catch(e) {}
 }
 
 if (this.itemPull[id]["type"] == "radio"){var imgSrc = this.itemPull[id][(this.itemPull[id]["state"]=="enabled"?"imgen":"imgdis")];}else {var imgSrc = this.itemPull[id][(this.itemPull[id]["state"]=="enabled"?"imgen":"imgdis")];}
 
 if (imgSrc.length > 0){if (imgObj != null){imgObj.src = this.imagePath+imgSrc;}else {if (isTopLevel){var imgObj = document.createElement("IMG");imgObj.className = "dhtmlxMenu_TopLevel_Item_Icon";imgObj.src = this.imagePath+imgSrc;imgObj.border = "0";imgObj.id = "image_"+id;if (!this._rtl && this.idPull[id].childNodes.length > 0)this.idPull[id].insertBefore(imgObj,this.idPull[id].childNodes[0]);else this.idPull[id].appendChild(imgObj);}else {var imgObj = document.createElement("IMG");imgObj.className = "sub_icon";imgObj.src = this.imagePath+imgSrc;imgObj.border = "0";imgObj.id = "image_"+id;var item = this.idPull[id].childNodes[this._rtl?2:0];while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.appendChild(imgObj);}
 }
 }else {if (imgObj != null)imgObj.parentNode.removeChild(imgObj);}
}
dhtmlXMenuObject.prototype.removeItem = function(id, _isTId, _recCall) {if (!_isTId)id = this.idPrefix + id;var pId = null;if (id != this.idPrefix+this.topId){if (this.itemPull[id] == null)return;if (this.idPull["polygon_"+id] && this.idPull["polygon_"+id]._tmShow)window.clearTimeout(this.idPull["polygon_"+id]._tmShow);var t = this.itemPull[id]["type"];if (t == "separator"){var item = this.idPull["separator_"+id];if (this.itemPull[id]["parent"] == this.idPrefix+this.topId){item.onclick = null;item.onselectstart = null;item.id = null;item.parentNode.removeChild(item);}else {item.childNodes[0].childNodes[0].onclick = null;item.childNodes[0].childNodes[0].onselectstart = null;item.childNodes[0].childNodes[0].id = null;item.childNodes[0].removeChild(item.childNodes[0].childNodes[0]);item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);}
 this.idPull["separator_"+id] = null;this.itemPull[id] = null;delete this.idPull["separator_"+id];delete this.itemPull[id];item = null;}else {pId = this.itemPull[id]["parent"];var item = this.idPull[id];item.onclick = null;item.oncontextmenu = null;item.onmouseover = null;item.onmouseout = null;item.onselectstart = null;item.id = null;while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.parentNode.removeChild(item);this.idPull[id] = null;this.itemPull[id] = null;delete this.idPull[id];delete this.itemPull[id];item = null;}
 t = null;}
 
 
 for (var a in this.itemPull)if (this.itemPull[a]["parent"] == id)this.removeItem(a, true, true);var p2 = new Array(id);if (pId != null && !_recCall){if (this.idPull["polygon_"+pId] != null){if (this.idPull["polygon_"+pId].tbd.childNodes.length == 0){p2.push(pId);this._updateItemComplexState(pId, false, false);}
 }
 }
 
 
 for (var q=0;q<p2.length;q++){if (this.idPull["polygon_"+p2[q]]){var p = this.idPull["polygon_"+p2[q]];p.onclick = null;p.oncontextmenu = null;p.tbl.removeChild(p.tbd);p.tbd = null;p.removeChild(p.tbl);p.tbl = null;p.id = null;p.parentNode.removeChild(p);p = null;if (this._isIE6){var pc = "polygon_"+p2[q]+"_ie6cover";if (this.idPull[pc] != null){document.body.removeChild(this.idPull[pc]);delete this.idPull[pc];}
 }
 if (this.idPull["arrowup_"+id] != null && this._removeArrow)this._removeArrow("arrowup_"+id);if (this.idPull["arrowdown_"+id] != null && this._removeArrow)this._removeArrow("arrowdown_"+id);this.idPull["polygon_"+p2[q]] = null;delete this.idPull["polygon_"+p2[q]];}
 }
 p2 = null;if (this.skin == "dhx_terrace" && arguments.length == 1)this._improveTerraceSkin();}
dhtmlXMenuObject.prototype._getAllParents = function(id) {var parents = new Array();for (var a in this.itemPull){if (this.itemPull[a]["parent"] == id){parents[parents.length] = this.itemPull[a]["id"];if (this.itemPull[a]["complex"]){var t = this._getAllParents(this.itemPull[a]["id"]);for (var q=0;q<t.length;q++){parents[parents.length] = t[q];}
 }
 }
 }
 return parents;}
 




dhtmlXMenuObject.prototype.renderAsContextMenu = function() {this.context = true;if (this.base._autoSkinUpdate == true){this.base.className = this.base.className.replace("dhtmlxMenu_"+this.skin+"_Middle","");this.base._autoSkinUpdate = false;}
 if (this.addBaseIdAsContextZone != null){this.addContextZone(this.addBaseIdAsContextZone);}
}
dhtmlXMenuObject.prototype.addContextZone = function(zoneId) {if (zoneId == document.body){zoneId = "document.body."+this.idPrefix;var zone = document.body;}else {var zone = document.getElementById(zoneId);}
 var zoneExists = false;for (var a in this.contextZones){zoneExists = zoneExists || (a == zoneId) || (this.contextZones[a] == zone);}
 if (zoneExists == true)return false;this.contextZones[zoneId] = zone;var main_self = this;if (_isOpera){this.operaContext = function(e){main_self._doOnContextMenuOpera(e, main_self);}
 zone.addEventListener("mouseup", this.operaContext, false);}else {if (zone.oncontextmenu != null && !zone._oldContextMenuHandler)zone._oldContextMenuHandler = zone.oncontextmenu;zone.oncontextmenu = function(e) {for (var q in dhtmlxMenuObjectLiveInstances){if (q != main_self._UID){if (dhtmlxMenuObjectLiveInstances[q].context){dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();}
 }
 }
 
 e = e||event;e.cancelBubble = true;e.returnValue = false;main_self._doOnContextBeforeCall(e, this);return false;}
 }
}
dhtmlXMenuObject.prototype._doOnContextMenuOpera = function(e, main_self) {for (var q in dhtmlxMenuObjectLiveInstances){if (q != main_self._UID){if (dhtmlxMenuObjectLiveInstances[q].context){dhtmlxMenuObjectLiveInstances[q]._hideContextMenu();}
 }
 }
 
 e.cancelBubble = true;e.returnValue = false;if (e.button == 0 && e.ctrlKey == true){main_self._doOnContextBeforeCall(e, this);}
 return false;}
dhtmlXMenuObject.prototype.removeContextZone = function(zoneId) {if (!this.isContextZone(zoneId)) return false;if (zoneId == document.body)zoneId = "document.body."+this.idPrefix;var zone = this.contextZones[zoneId];if (_isOpera){zone.removeEventListener("mouseup", this.operaContext, false);}else {zone.oncontextmenu = (zone._oldContextMenuHandler!=null?zone._oldContextMenuHandler:null);zone._oldContextMenuHandler = null;}
 try {this.contextZones[zoneId] = null;delete this.contextZones[zoneId];}catch(e){}
 return true;}
dhtmlXMenuObject.prototype.isContextZone = function(zoneId) {if (zoneId == document.body && this.contextZones["document.body."+this.idPrefix] != null)return true;var isZone = false;if (this.contextZones[zoneId] != null){if (this.contextZones[zoneId] == document.getElementById(zoneId)) isZone = true;}
 return isZone;}
dhtmlXMenuObject.prototype._isContextMenuVisible = function() {if (this.idPull["polygon_"+this.idPrefix+this.topId] == null)return false;return (this.idPull["polygon_"+this.idPrefix+this.topId].style.display == "");}
dhtmlXMenuObject.prototype._showContextMenu = function(x, y, zoneId) {this._clearAndHide();if (this.idPull["polygon_"+this.idPrefix+this.topId] == null)return false;window.clearTimeout(this.menuTimeoutHandler);this.idPull[this.idPrefix+this.topId] = new Array(x, y);this._showPolygon(this.idPrefix+this.topId, "bottom");this.callEvent("onContextMenu", [zoneId]);}
dhtmlXMenuObject.prototype._hideContextMenu = function() {if (this.idPull["polygon_"+this.idPrefix+this.topId] == null)return false;this._clearAndHide();this._hidePolygon(this.idPrefix+this.topId);this.zInd = this.zIndInit;}
dhtmlXMenuObject.prototype._doOnContextBeforeCall = function(e, cZone) {this.contextMenuZoneId = cZone.id;this._clearAndHide();this._hideContextMenu();var p = (e.srcElement||e.target);var px = (_isIE||_isOpera||_KHTMLrv?e.offsetX:e.layerX);var py = (_isIE||_isOpera||_KHTMLrv?e.offsetY:e.layerY);var mx = getAbsoluteLeft(p)+px;var my = getAbsoluteTop(p)+py;if (this.checkEvent("onBeforeContextMenu")) {if (this.callEvent("onBeforeContextMenu", [cZone.id,e])) {if (this.contextAutoShow){this._showContextMenu(mx, my);this.callEvent("onAfterContextMenu", [cZone.id,e]);}
 }
 }else {if (this.contextAutoShow){this._showContextMenu(mx, my);this.callEvent("onAfterContextMenu", [cZone.id]);}
 }
}
dhtmlXMenuObject.prototype.showContextMenu = function(x, y) {this._showContextMenu(x, y, false);}
dhtmlXMenuObject.prototype.hideContextMenu = function() {this._hideContextMenu();}
dhtmlXMenuObject.prototype._autoDetectVisibleArea = function() {if (this._isVisibleArea)return;this.menuX1 = document.body.scrollLeft;this.menuX2 = this.menuX1+(window.innerWidth||document.body.clientWidth);this.menuY1 = Math.max((_isIE?document.documentElement:document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);this.menuY2 = this.menuY1+(_isIE?Math.max(document.documentElement.clientHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0):window.innerHeight);}
dhtmlXMenuObject.prototype.getItemPosition = function(id) {id = this.idPrefix+id;var pos = -1;if (this.itemPull[id] == null)return pos;var parent = this.itemPull[id]["parent"];var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.cont);for (var q=0;q<obj.childNodes.length;q++){if (obj.childNodes[q]==this.idPull["separator_"+id]||obj.childNodes[q]==this.idPull[id]){pos = q;}}
 return pos;}
dhtmlXMenuObject.prototype.setItemPosition = function(id, pos) {id = this.idPrefix+id;if (this.idPull[id] == null){return;}
 
 var isOnTopLevel = (this.itemPull[id]["parent"] == this.idPrefix+this.topId);var itemData = this.idPull[id];var itemPos = this.getItemPosition(id.replace(this.idPrefix,""));var parent = this.itemPull[id]["parent"];var obj = (this.idPull["polygon_"+parent]!=null?this.idPull["polygon_"+parent].tbd:this.cont);obj.removeChild(obj.childNodes[itemPos]);if (pos < 0)pos = 0;if (isOnTopLevel && pos < 1){pos = 1;}
 
 if (pos < obj.childNodes.length){obj.insertBefore(itemData, obj.childNodes[pos]);}else {obj.appendChild(itemData);}
}
dhtmlXMenuObject.prototype.getParentId = function(id) {id = this.idPrefix+id;if (this.itemPull[id] == null){return null;}
 return ((this.itemPull[id]["parent"]!=null?this.itemPull[id]["parent"]:this.topId).replace(this.idPrefix,""));}
dhtmlXMenuObject.prototype.addNewSibling = function(nextToId, itemId, itemText, disabled, imgEnabled, imgDisabled) {var id = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var parentId = this.idPrefix+(nextToId!=null?this.getParentId(nextToId):this.topId);this._addItemIntoGlobalStrorage(id, parentId, itemText, "item", disabled, imgEnabled, imgDisabled);if ((parentId == this.idPrefix+this.topId)&& (!this.context)) {this._renderToplevelItem(id, this.getItemPosition(nextToId));}else {this._renderSublevelItem(id, this.getItemPosition(nextToId));}
}
dhtmlXMenuObject.prototype.addNewChild = function(parentId, pos, itemId, itemText, disabled, imgEnabled, imgDisabled) {if (parentId == null){if (this.context){parentId = this.topId;}else {this.addNewSibling(parentId, itemId, itemText, disabled, imgEnabled, imgDisabled);if (pos != null)this.setItemPosition(itemId, pos);return;}
 }
 itemId = this.idPrefix+(itemId!=null?itemId:this._genStr(24));if (this.setHotKey)this.setHotKey(parentId, "");parentId = this.idPrefix+parentId;this._addItemIntoGlobalStrorage(itemId, parentId, itemText, "item", disabled, imgEnabled, imgDisabled);if (this.idPull["polygon_"+parentId] == null){this._renderSublevelPolygon(parentId, parentId);}
 this._renderSublevelItem(itemId, pos-1);this._redefineComplexState(parentId);}
dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function(itemId, itemParentId, itemText, itemType, disabled, img, imgDis) {var item = {id: itemId,
 title: itemText,
 imgen: (img!=null?img:""),
 imgdis: (imgDis!=null?imgDis:""),
 type: itemType,
 state: (disabled==true?"disabled":"enabled"),
 parent: itemParentId,
 complex:false,
 hotkey: "",
 tip: ""};this.itemPull[item.id] = item;}
dhtmlXMenuObject.prototype._addSubMenuPolygon = function(id, parentId) {var s = this._renderSublevelPolygon(id, parentId);var j = this._getMenuNodes(parentId);for (q=0;q<j.length;q++){if (this.itemPull[j[q]]["type"] == "separator"){this._renderSeparator(j[q], null);}else {this._renderSublevelItem(j[q], null);}}
 if (id == parentId){var level = "topLevel";}else {var level = "subLevel";}
 for (var q=0;q<j.length;q++){if (this.itemPull[j[q]]["complex"]){this._addSubMenuPolygon(id, this.itemPull[j[q]]["id"]);}}
}
dhtmlXMenuObject.prototype._renderSublevelPolygon = function(id, parentId) {var s = document.createElement("DIV");s.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_Polygon "+(this._rtl?"dir_right":"");s.dir = "ltr";s.oncontextmenu = function(e) {e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 s.id = "polygon_" + parentId;s.onclick = function(e) {e = e || event;e.cancelBubble = true;}
 s.style.display = "none";document.body.insertBefore(s, document.body.firstChild);var tbl = document.createElement("TABLE");tbl.className = "dhtmlxMebu_SubLevelArea_Tbl";tbl.cellSpacing = 0;tbl.cellPadding = 0;tbl.border = 0;var tbd = document.createElement("TBODY");tbl.appendChild(tbd);s.appendChild(tbl);s.tbl = tbl;s.tbd = tbd;this.idPull[s.id] = s;if (this.sxDacProc != null){this.idPull["sxDac_" + parentId] = new this.sxDacProc(s, s.className);if (_isIE){this.idPull["sxDac_" + parentId]._setSpeed(this.dacSpeedIE);this.idPull["sxDac_" + parentId]._setCustomCycle(this.dacCyclesIE);}else {this.idPull["sxDac_" + parentId]._setSpeed(this.dacSpeed);this.idPull["sxDac_" + parentId]._setCustomCycle(this.dacCycles);}
 }
 return s;}
dhtmlXMenuObject.prototype._renderSublevelItem = function(id, pos) {var main_self = this;var tr = document.createElement("TR");tr.className = (this.itemPull[id]["state"]=="enabled"?"sub_item":"sub_item_dis");var t1 = document.createElement("TD");t1.className = "sub_item_icon";var icon = this.itemPull[id][(this.itemPull[id]["state"]=="enabled"?"imgen":"imgdis")];if (icon != ""){var tp = this.itemPull[id]["type"];if (tp=="checkbox"||tp=="radio"){var img = document.createElement("DIV");img.id = "image_"+this.itemPull[id]["id"];img.className = "sub_icon "+icon;t1.appendChild(img);}
 if (!(tp=="checkbox"||tp=="radio")) {var img = document.createElement("IMG");img.id = "image_"+this.itemPull[id]["id"];img.className = "sub_icon";img.src = this.imagePath+icon;t1.appendChild(img);}
 }
 
 
 var t2 = document.createElement("TD");t2.className = "sub_item_text";if (this.itemPull[id]["title"] != ""){var t2t = document.createElement("DIV");t2t.className = "sub_item_text";t2t.innerHTML = this.itemPull[id]["title"];t2.appendChild(t2t);}else {t2.innerHTML = "&nbsp;";}
 
 
 var t3 = document.createElement("TD");t3.className = "sub_item_hk";if (this.itemPull[id]["complex"]){var arw = document.createElement("DIV");arw.className = "complex_arrow";arw.id = "arrow_"+this.itemPull[id]["id"];t3.appendChild(arw);}else {if (this.itemPull[id]["hotkey"].length > 0 && !this.itemPull[id]["complex"]){var t3t = document.createElement("DIV");t3t.className = "sub_item_hk";t3t.innerHTML = this.itemPull[id]["hotkey"];t3.appendChild(t3t);}else {t3.innerHTML = "&nbsp;";}
 }
 tr.appendChild(this._rtl?t3:t1);tr.appendChild(t2);tr.appendChild(this._rtl?t1:t3);tr.id = this.itemPull[id]["id"];tr.parent = this.itemPull[id]["parent"];if (this.itemPull[id]["tip"].length > 0)tr.title = this.itemPull[id]["tip"];if (!this._hideTMData)this._hideTMData = {};tr.onselectstart = function(e) {e = e || event;e.returnValue = false;return false;}
 tr.onmouseover = function(e) {if (main_self.menuMode == "web"){if (main_self._hideTMData[this.id])window.clearTimeout(main_self._hideTMData[this.id]);window.clearTimeout(main_self.menuTimeoutHandler);}
 if (!this._visible)main_self._redistribSubLevelSelection(this.id, this.parent);this._visible = true;}
 if (main_self.menuMode == "web"){tr.onmouseout = function() {if (main_self.menuTimeoutHandler)window.clearTimeout(main_self.menuTimeoutHandler);main_self.menuTimeoutHandler = window.setTimeout(function(){main_self._clearAndHide();}, main_self.menuTimeoutMsec, "JavaScript");var k = this;if (main_self._hideTMData[this.id])window.clearTimeout(main_self._hideTMData[this.id]);main_self._hideTMData[this.id] = window.setTimeout(function(){k._visible=false;}, 50);}
 }
 tr.onclick = function(e) {if (!main_self.checkEvent("onClick")&& main_self.itemPull[this.id]["complex"]) return;e = e || event;e.cancelBubble = true;e.returnValue = false;tc = (main_self.itemPull[this.id]["complex"]?"c":"-");td = (main_self.itemPull[this.id]["state"]=="enabled"?"-":"d");var cas = {"ctrl": e.ctrlKey, "alt": e.altKey, "shift": e.shiftKey};switch (main_self.itemPull[this.id]["type"]) {case "checkbox":
 main_self._checkboxOnClickHandler(this.id.replace(main_self.idPrefix, ""), tc+td+"n", cas);break;case "radio":
 main_self._radioOnClickHandler(this.id.replace(main_self.idPrefix, ""), tc+td+"n", cas);break;case "item":
 main_self._doOnClick(this.id.replace(main_self.idPrefix, ""), tc+td+"n", cas);break;}
 return false;}
 
 var polygon = this.idPull["polygon_"+this.itemPull[id]["parent"]];if (pos != null){pos++;if (pos < 0)pos = 0;if (pos > polygon.tbd.childNodes.length - 1)pos = null;}
 if (pos != null && polygon.tbd.childNodes[pos] != null)polygon.tbd.insertBefore(tr, polygon.tbd.childNodes[pos]);else polygon.tbd.appendChild(tr);this.idPull[tr.id] = tr;}
dhtmlXMenuObject.prototype._renderSeparator = function(id, pos) {var level = (this.context?"SubLevelArea":(this.itemPull[id]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea"));if (level == "TopLevel" && this.context)return;var main_self = this;if (level != "TopLevel"){var tr = document.createElement("TR");tr.className = "sub_sep";var td = document.createElement("TD");td.colSpan = "3";tr.appendChild(td);}
 
 var k = document.createElement("DIV");k.id = "separator_"+id;k.className = (level=="TopLevel"?"top_sep":"sub_sep");k.onselectstart = function(e) {e = e || event;e.returnValue = false;}
 k.onclick = function(e) {e = e || event;e.cancelBubble = true;var cas = {"ctrl": e.ctrlKey, "alt": e.altKey, "shift": e.shiftKey};main_self._doOnClick(this.id.replace("separator_" + main_self.idPrefix, ""), "--s", cas);}
 if (level == "TopLevel"){if (pos != null){pos++;if (pos < 0){pos = 0;}
 
 if (this.cont.childNodes[pos] != null){this.cont.insertBefore(k, this.cont.childNodes[pos]);}else {this.cont.appendChild(k);}
 }else {var last = this.cont.childNodes[this.cont.childNodes.length-1];if (String(last).search("TopLevel_Text") == -1) {this.cont.appendChild(k);}else {this.cont.insertBefore(k, last);}
 }
 this.idPull[k.id] = k;}else {var polygon = this.idPull["polygon_"+this.itemPull[id]["parent"]];if (pos != null){pos++;if (pos < 0)pos = 0;if (pos > polygon.tbd.childNodes.length - 1)pos = null;}
 if (pos != null && polygon.tbd.childNodes[pos] != null)polygon.tbd.insertBefore(tr, polygon.tbd.childNodes[pos]);else polygon.tbd.appendChild(tr);td.appendChild(k);this.idPull[k.id] = tr;}
}
dhtmlXMenuObject.prototype.addNewSeparator = function(nextToId, itemId) {itemId = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var parentId = this.idPrefix+this.getParentId(nextToId);this._addItemIntoGlobalStrorage(itemId, parentId, "", "separator", false, "", "");this._renderSeparator(itemId, this.getItemPosition(nextToId));}
dhtmlXMenuObject.prototype.hide = function() {this._clearAndHide();}
dhtmlXMenuObject.prototype.clearAll = function() {this.removeItem(this.idPrefix+this.topId, true);this._isInited = false;this.idPrefix = this._genStr(12);}
dhtmlXMenuObject.prototype.unload = function() {if (_isIE){document.body.detachEvent("onclick", this._bodyClick);document.body.detachEvent("oncontextmenu", this._bodyContext);}else {window.removeEventListener("click", this._bodyClick, false);window.removeEventListener("contextmenu", this._bodyContext, false);}
 this._bodyClick = null;this._bodyContext = null;this.removeItem(this.idPrefix+this.topId, true);this.itemPull = null;this.idPull = null;if (this.context)for (var a in this.contextZones)this.removeContextZone(a);if (this.cont != null){this.cont.className = "";this.cont.parentNode.removeChild(this.cont);this.cont = null;}
 
 if (this.base != null){this.base.className = "";if (!this.context)this.base.oncontextmenu = (this.base._oldContextMenuHandler||null);this.base.onselectstart = null;this.base = null;}
 this.setSkin = null;this.detachAllEvents();if (this._xmlLoader){this._xmlLoader.destructor();this._xmlLoader = null;}
 
 this._align = null;this._arrowFFFix = null;this._isIE6 = null;this._isInited = null;this._rtl = null;this._scrollDownTMStep = null;this._scrollDownTMTime = null;this._scrollUpTMStep = null;this._scrollUpTMTime = null;this._topLevelBottomMargin = null;this._topLevelOffsetLeft = null;this._topLevelBottomMargin = null;this._topLevelRightMargin = null;this.addBaseIdAsContextZone = null;this.context = null;this.contextAutoHide = null;this.contextAutoShow = null;this.contextHideAllMode = null;this.contextMenuZoneId = null;this.dLoad = null;this.dLoadSign = null;this.dLoadUrl = null;this.loaderIcon = null;this.fixedPosition = null;this.dirSubLevel = null;this.dirTopLevel = null;this.limit = null;this.menuSelected = null;this.menuLastClicked = null;this.idPrefix = null;this.imagePath = null;this.menuMode = null;this.menuModeTopLevelTimeout = null;this.menuModeTopLevelTimeoutTime = null;this.menuTimeoutHandler = null;this.menuTimeoutMsec = null;this.menuTouched = null;this.isDhtmlxMenuObject = null;this.itemHotKeyTagName = null;this.itemHrefTagName = null;this.itemTagName = null;this.itemTextTagName = null;this.itemTipTagName = null;this.userDataTagName = null;this.skin = null;this.topId = null;this.dacCycles = null;this.dacCyclesIE = null;this.dacSpeed = null;this.dacSpeedIE = null;this.zInd = null;this.zIndInit = null;this.zIndStep = null;this._enableDacSupport = null;this._selectedSubItems = null;this._openedPolygons = null;this._addSubItemToSelected = null;this._removeSubItemFromSelected = null;this._getSubItemToDeselectByPolygon = null;this._hidePolygon = null;this._showPolygon = null;this._redistribSubLevelSelection = null;this._doOnClick = null;this._doOnTouchMenu = null;this._searchMenuNode = null;this._getMenuNodes = null;this._genStr = null;this._clearAndHide = null;this._doOnLoad = null;this.getItemType = null;this.forEachItem = null;this.init = null;this.loadXML = null;this.loadXMLString = null;this._buildMenu = null;this._xmlParser = null;this._showSubLevelItem = null;this._hideSubLevelItem = null;this._countVisiblePolygonItems = null;this._redefineComplexState = null;this._updateItemComplexState = null;this._getItemLevelType = null;this._redistribTopLevelSelection = null;this._initTopLevelMenu = null;this._renderToplevelItem = null;this.setImagePath = null;this.setIconsPath = null;this.setIconPath = null;this._updateItemImage = null;this.removeItem = null;this._getAllParents = null;this.renderAsContextMenu = null;this.addContextZone = null;this.removeContextZone = null;this.isContextZone = null;this._isContextMenuVisible = null;this._showContextMenu = null;this._doOnContextBeforeCall = null;this._autoDetectVisibleArea = null;this._addItemIntoGlobalStrorage = null;this._addSubMenuPolygon = null;this._renderSublevelPolygon = null;this._renderSublevelItem = null;this._renderSeparator = null;this._hideContextMenu = null;this.clearAll = null;this.getItemPosition = null;this.setItemPosition = null;this.getParentId = null;this.addNewSibling = null;this.addNewChild = null;this.addNewSeparator = null;this.attachEvent = null;this.callEvent = null;this.checkEvent = null;this.eventCatcher = null;this.detachEvent = null;this.dhx_Event = null;this.unload = null;this.items = null;this.radio = null;this.detachAllEvents = null;this.hide = null;this.showContextMenu = null;this.hideContextMenu = null;this._changeItemState = null;this._changeItemVisible = null;this._updateLoaderIcon = null;this._clearAllSelectedSubItemsInPolygon = null;this._checkArrowsState = null;this._addUpArrow = null;this._addDownArrow = null;this._removeUpArrow = null;this._removeDownArrow = null;this._isArrowExists = null;this._doScrollUp = null;this._doScrollDown = null;this._countPolygonItems = null;this._getRadioImgObj = null;this._setRadioState = null;this._radioOnClickHandler = null;this._getCheckboxState = null;this._setCheckboxState = null;this._readLevel = null;this._updateCheckboxImage = null;this._checkboxOnClickHandler = null;this._removeArrow = null;this.setItemEnabled = null;this.setItemDisabled = null;this.isItemEnabled = null;this.getItemText = null;this.setItemText = null;this.loadFromHTML = null;this.hideItem = null;this.showItem = null;this.isItemHidden = null;this.setUserData = null;this.getUserData = null;this.setOpenMode = null;this.setWebModeTimeout = null;this.enableDynamicLoading = null;this.getItemImage = null;this.setItemImage = null;this.clearItemImage = null;this.setAutoShowMode = null;this.setAutoHideMode = null;this.setContextMenuHideAllMode = null;this.getContextMenuHideAllMode = null;this.setVisibleArea = null;this.setTooltip = null;this.getTooltip = null;this.setHotKey = null;this.getHotKey = null;this.setItemSelected = null;this.setTopText = null;this.setRTL = null;this.setAlign = null;this.setHref = null;this.clearHref = null;this.getCircuit = null;this.contextZones = null;this.setOverflowHeight = null;this.userData = null;this.getRadioChecked = null;this.setRadioChecked = null;this.addRadioButton = null;this.setCheckboxState = null;this.getCheckboxState = null;this.addCheckbox = null;this.serialize = null;this.extendedModule = null;dhtmlxMenuObjectLiveInstances[this._UID] = null;try {delete dhtmlxMenuObjectLiveInstances[this._UID];}catch(e) {}
 this._UID = null;}
var dhtmlxMenuObjectLiveInstances = {};dhtmlXMenuObject.prototype.i18n = {dhxmenuextalert: "dhtmlxmenu_ext.js required"
};(function(){dhtmlx.extend_api("dhtmlXMenuObject",{_init:function(obj){return [obj.parent, obj.skin];},
 align:"setAlign",
 top_text:"setTopText",
 context:"renderAsContextMenu",
 icon_path:"setIconsPath",
 open_mode:"setOpenMode",
 rtl:"setRTL",
 skin:"setSkin",
 dynamic:"enableDynamicLoading",
 xml:"loadXML",
 items:"items",
 overflow:"setOverflowHeight"
 },{items:function(arr,parent){var pos = 100000;var lastItemId = null;for (var i=0;i < arr.length;i++){var item=arr[i];if (item.type == "separator"){this.addNewSeparator(lastItemId, pos, item.id);lastItemId = item.id;}else {this.addNewChild(parent, pos, item.id, item.text, item.disabled, item.img, item.img_disabled);lastItemId = item.id;if (item.items)this.items(item.items,item.id);}
 }
 }
 });})();dhtmlXMenuObject.prototype._improveTerraceSkin = function() {for (var a in this.itemPull){if (this.itemPull[a].parent == this.idPrefix+this.topId && this.idPull[a] != null){var bl = false;var br = false;if (this.idPull[a].parentNode.firstChild == this.idPull[a]){bl = true;}
 
 
 if (this.idPull[a].parentNode.lastChild == this.idPull[a]){br = true;}
 
 
 for (var b in this.itemPull){if (this.itemPull[b].type == "separator" && this.itemPull[b].parent == this.idPrefix+this.topId){if (this.idPull[a].nextSibling == this.idPull["separator_"+b]){br = true;}
 if (this.idPull[a].previousSibling == this.idPull["separator_"+b]){bl = true;}
 }
 }
 
 this.idPull[a].style.borderLeft = (bl?"1px solid #cecece":"0px solid white");this.idPull[a].style.borderTopLeftRadius = this.idPull[a].style.borderBottomLeftRadius = (bl?"5px":"0px");this.idPull[a].style.borderTopRightRadius = this.idPull[a].style.borderBottomRightRadius = (br?"5px":"0px");this.idPull[a]._bl = bl;this.idPull[a]._br = br;}
 }
 
};dhtmlXMenuObject.prototype._improveTerraceButton = function(id, state) {if (state){this.idPull[id].style.borderBottomLeftRadius = (this.idPull[id]._bl ? "5px" : "0px");this.idPull[id].style.borderBottomRightRadius = (this.idPull[id]._br ? "5px" : "0px");}else {this.idPull[id].style.borderBottomLeftRadius = "0px";this.idPull[id].style.borderBottomRightRadius = "0px";}
};dhtmlXMenuObject.prototype.extendedModule = "DHXMENUEXT";dhtmlXMenuObject.prototype.setItemEnabled = function(id) {this._changeItemState(id, "enabled", this._getItemLevelType(id));}
dhtmlXMenuObject.prototype.setItemDisabled = function(id) {this._changeItemState(id, "disabled", this._getItemLevelType(id));}
dhtmlXMenuObject.prototype.isItemEnabled = function(id) {return (this.itemPull[this.idPrefix+id]!=null?(this.itemPull[this.idPrefix+id]["state"]=="enabled"):false);}
dhtmlXMenuObject.prototype._changeItemState = function(id, newState, levelType) {var t = false;var j = this.idPrefix + id;if ((this.itemPull[j] != null)&& (this.idPull[j] != null)) {if (this.itemPull[j]["state"] != newState){this.itemPull[j]["state"] = newState;if (this.itemPull[j]["parent"] == this.idPrefix+this.topId && !this.context){this.idPull[j].className = "dhtmlxMenu_"+this.skin+"_TopLevel_Item_"+(this.itemPull[j]["state"]=="enabled"?"Normal":"Disabled");}else {this.idPull[j].className = "sub_item"+(this.itemPull[j]["state"]=="enabled"?"":"_dis");}
 
 this._updateItemComplexState(this.idPrefix+id, this.itemPull[this.idPrefix+id]["complex"], false);this._updateItemImage(id, levelType);if ((this.idPrefix + this.menuLastClicked == j)&& (levelType != "TopLevel")) {this._redistribSubLevelSelection(j, this.itemPull[j]["parent"]);}
 if (levelType == "TopLevel" && !this.context){}
 }
 }
 return t;}
dhtmlXMenuObject.prototype.getItemText = function(id) {return (this.itemPull[this.idPrefix+id]!=null?this.itemPull[this.idPrefix+id]["title"]:"");}
dhtmlXMenuObject.prototype.setItemText = function(id, text) {id = this.idPrefix + id;if ((this.itemPull[id] != null)&& (this.idPull[id] != null)) {this._clearAndHide();this.itemPull[id]["title"] = text;if (this.itemPull[id]["parent"] == this.idPrefix+this.topId && !this.context){var tObj = null;for (var q=0;q<this.idPull[id].childNodes.length;q++){try {if (this.idPull[id].childNodes[q].className == "top_level_text")tObj = this.idPull[id].childNodes[q];}catch(e) {}
 }
 if (String(this.itemPull[id]["title"]).length == "" || this.itemPull[id]["title"] == null) {if (tObj != null)tObj.parentNode.removeChild(tObj);}else {if (!tObj){tObj = document.createElement("DIV");tObj.className = "top_level_text";if (this._rtl && this.idPull[id].childNodes.length > 0)this.idPull[id].insertBefore(tObj,this.idPull[id].childNodes[0]);else this.idPull[id].appendChild(tObj);}
 tObj.innerHTML = this.itemPull[id]["title"];}
 }else {var tObj = null;for (var q=0;q<this.idPull[id].childNodes[1].childNodes.length;q++){if (String(this.idPull[id].childNodes[1].childNodes[q].className||"")== "sub_item_text") tObj = this.idPull[id].childNodes[1].childNodes[q];}
 if (String(this.itemPull[id]["title"]).length == "" || this.itemPull[id]["title"] == null) {if (tObj){tObj.parentNode.removeChild(tObj);tObj = null;this.idPull[id].childNodes[1].innerHTML = "&nbsp;";}
 }else {if (!tObj){tObj = document.createElement("DIV");tObj.className = "sub_item_text";this.idPull[id].childNodes[1].innerHTML = "";this.idPull[id].childNodes[1].appendChild(tObj);}
 tObj.innerHTML = this.itemPull[id]["title"];}
 }
 }
}
dhtmlXMenuObject.prototype.loadFromHTML = function(objId, clearAfterAdd, onLoadFunction) {this.itemTagName = "DIV";if (typeof(objId)== "string") {objId = document.getElementById(objId);}
 this._buildMenu(objId, null);this.init();if (clearAfterAdd){objId.parentNode.removeChild(objId);}
 if (onLoadFunction != null){onLoadFunction();}
}
dhtmlXMenuObject.prototype.hideItem = function(id) {this._changeItemVisible(id, false);}
dhtmlXMenuObject.prototype.showItem = function(id) {this._changeItemVisible(id, true);}
dhtmlXMenuObject.prototype.isItemHidden = function(id) {var isHidden = null;if (this.idPull[this.idPrefix+id] != null){isHidden = (this.idPull[this.idPrefix+id].style.display == "none");}
 return isHidden;}
dhtmlXMenuObject.prototype._changeItemVisible = function(id, visible) {var itemId = this.idPrefix+id;if (this.itemPull[itemId] == null)return;if (this.itemPull[itemId]["type"] == "separator"){itemId = "separator_"+itemId;}
 if (this.idPull[itemId] == null)return;this.idPull[itemId].style.display = (visible?"":"none");this._redefineComplexState(this.itemPull[this.idPrefix+id]["parent"]);}
dhtmlXMenuObject.prototype.setUserData = function(id, name, value) {this.userData[this.idPrefix+id+"_"+name] = value;}
dhtmlXMenuObject.prototype.getUserData = function(id, name) {return (this.userData[this.idPrefix+id+"_"+name]!=null?this.userData[this.idPrefix+id+"_"+name]:null);}
dhtmlXMenuObject.prototype.setOpenMode = function(mode) {if (mode == "win" || mode == "web")this.menuMode = mode;else this.menuMode == "web";}
dhtmlXMenuObject.prototype.setWebModeTimeout = function(tm) {this.menuTimeoutMsec = (!isNaN(tm)?tm:400);}
dhtmlXMenuObject.prototype.enableDynamicLoading = function(url, icon) {this.dLoad = true;this.dLoadUrl = url;this.dLoadSign = (String(this.dLoadUrl).search(/\?/)==-1?"?":"&");this.loaderIcon = icon;this.init();}
dhtmlXMenuObject.prototype._updateLoaderIcon = function(id, state) {if (this.idPull[id] == null)return;if (String(this.idPull[id].className).search("TopLevel_Item") >= 0) return;var ind = (this._rtl?0:2);if (!this.idPull[id].childNodes[ind])return;if (!this.idPull[id].childNodes[ind].childNodes[0])return;var aNode = this.idPull[id].childNodes[ind].childNodes[0];if (String(aNode.className).search("complex_arrow") === 0) aNode.className = "complex_arrow"+(state?"_loading":"");}
dhtmlXMenuObject.prototype.getItemImage = function(id) {var imgs = new Array(null, null);id = this.idPrefix+id;if (this.itemPull[id]["type"] == "item"){imgs[0] = this.itemPull[id]["imgen"];imgs[1] = this.itemPull[id]["imgdis"];}
 return imgs;}
dhtmlXMenuObject.prototype.setItemImage = function(id, img, imgDis) {if (this.itemPull[this.idPrefix+id]["type"] != "item")return;this.itemPull[this.idPrefix+id]["imgen"] = img;this.itemPull[this.idPrefix+id]["imgdis"] = imgDis;this._updateItemImage(id, this._getItemLevelType(id));}
dhtmlXMenuObject.prototype.clearItemImage = function(id) {this.setItemImage(id, "", "");}
dhtmlXMenuObject.prototype.setAutoShowMode = function(mode) {this.contextAutoShow = (mode==true?true:false);}
dhtmlXMenuObject.prototype.setAutoHideMode = function(mode) {this.contextAutoHide = (mode==true?true:false);}
dhtmlXMenuObject.prototype.setContextMenuHideAllMode = function(mode) {this.contextHideAllMode = (mode==true?true:false);}
dhtmlXMenuObject.prototype.getContextMenuHideAllMode = function() {return this.contextHideAllMode;}
dhtmlXMenuObject.prototype.setVisibleArea = function(x1, x2, y1, y2) {this._isVisibleArea = true;this.menuX1 = x1;this.menuX2 = x2;this.menuY1 = y1;this.menuY2 = y2;}
dhtmlXMenuObject.prototype.setTooltip = function(id, tip) {id = this.idPrefix+id;if (!(this.itemPull[id] != null && this.idPull[id] != null)) return;this.idPull[id].title = (tip.length > 0 ? tip : null);this.itemPull[id]["tip"] = tip;}
dhtmlXMenuObject.prototype.getTooltip = function(id) {if (this.itemPull[this.idPrefix+id] == null)return null;return this.itemPull[this.idPrefix+id]["tip"];}
dhtmlXMenuObject.prototype.setHotKey = function(id, hkey) {id = this.idPrefix+id;if (!(this.itemPull[id] != null && this.idPull[id] != null)) return;if (this.itemPull[id]["parent"] == this.idPrefix+this.topId && !this.context)return;if (this.itemPull[id]["complex"])return;var t = this.itemPull[id]["type"];if (!(t == "item" || t == "checkbox" || t == "radio")) return;var hkObj = null;try {if (this.idPull[id].childNodes[this._rtl?0:2].childNodes[0].className == "sub_item_hk")hkObj = this.idPull[id].childNodes[this._rtl?0:2].childNodes[0];}catch(e){}
 
 if (hkey.length == 0){this.itemPull[id]["hotkey_backup"] = this.itemPull[id]["hotkey"];this.itemPull[id]["hotkey"] = "";if (hkObj != null)hkObj.parentNode.removeChild(hkObj);}else {this.itemPull[id]["hotkey"] = hkey;this.itemPull[id]["hotkey_backup"] = null;if (hkObj == null){hkObj = document.createElement("DIV");hkObj.className = "sub_item_hk";var item = this.idPull[id].childNodes[this._rtl?0:2];while (item.childNodes.length > 0)item.removeChild(item.childNodes[0]);item.appendChild(hkObj);}
 hkObj.innerHTML = hkey;}
}
dhtmlXMenuObject.prototype.getHotKey = function(id) {if (this.itemPull[this.idPrefix+id] == null)return null;return this.itemPull[this.idPrefix+id]["hotkey"];}
dhtmlXMenuObject.prototype.setItemSelected = function(id) {if (this.itemPull[this.idPrefix+id] == null)return null;}
dhtmlXMenuObject.prototype.setTopText = function(text) {if (this.context)return;if (this._topText == null){this._topText = document.createElement("DIV");this._topText.className = "dhtmlxMenu_TopLevel_Text_"+(this._rtl?"left":(this._align=="left"?"right":"left"));this.base.appendChild(this._topText);}
 this._topText.innerHTML = text;}
dhtmlXMenuObject.prototype.setAlign = function(align) {if (this._align == align)return;if (align == "left" || align == "right"){this._align = align;if (this.cont)this.cont.className = (this._align=="right"?"align_right":"align_left");if (this._topText != null)this._topText.className = "dhtmlxMenu_TopLevel_Text_"+(this._align=="left"?"right":"left");}
}
dhtmlXMenuObject.prototype.setHref = function(itemId, href, target) {if (this.itemPull[this.idPrefix+itemId] == null)return;this.itemPull[this.idPrefix+itemId]["href_link"] = href;if (target != null)this.itemPull[this.idPrefix+itemId]["href_target"] = target;}
dhtmlXMenuObject.prototype.clearHref = function(itemId) {if (this.itemPull[this.idPrefix+itemId] == null)return;delete this.itemPull[this.idPrefix+itemId]["href_link"];delete this.itemPull[this.idPrefix+itemId]["href_target"];}
dhtmlXMenuObject.prototype.getCircuit = function(id) {var parents = new Array(id);while (this.getParentId(id)!= this.topId) {id = this.getParentId(id);parents[parents.length] = id;}
 return parents.reverse();}
dhtmlXMenuObject.prototype._clearAllSelectedSubItemsInPolygon = function(polygon) {var subIds = this._getSubItemToDeselectByPolygon(polygon);for (var q=0;q<this._openedPolygons.length;q++){if (this._openedPolygons[q] != polygon){this._hidePolygon(this._openedPolygons[q]);}}
 for (var q=0;q<subIds.length;q++){if (this.idPull[subIds[q]] != null){if (this.itemPull[subIds[q]]["state"] == "enabled"){this.idPull[subIds[q]].className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_Item_Normal";}}}
}
dhtmlXMenuObject.prototype._checkArrowsState = function(id) {var polygon = this.idPull["polygon_"+id];var arrowUp = this.idPull["arrowup_"+id];var arrowDown = this.idPull["arrowdown_"+id];if (polygon.scrollTop == 0){arrowUp.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowUp_Disabled";}else {arrowUp.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowUp" + (arrowUp.over ? "_Over" : "");}
 if (polygon.scrollTop + polygon.offsetHeight < polygon.scrollHeight){arrowDown.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowDown" + (arrowDown.over ? "_Over" : "");}else {arrowDown.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowDown_Disabled";}
}
dhtmlXMenuObject.prototype._addUpArrow = function(id) {var main_self = this;var arrow = document.createElement("DIV");arrow.pId = this.idPrefix+id;arrow.id = "arrowup_"+this.idPrefix+id;arrow.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowUp";arrow.innerHTML = "<div class='dhtmlxMenu_"+this.skin+"_SubLevelArea_Arrow'><div class='dhtmlxMenu_SubLevelArea_Arrow_Icon'></div></div>";arrow.style.display = "none";arrow.over = false;arrow.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 arrow.oncontextmenu = function(e) {e = e||event;e.returnValue = false;return false;}
 
 arrow.onmouseover = function() {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);}
 main_self._clearAllSelectedSubItemsInPolygon(this.pId);if (this.className == "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowUp_Disabled")return;this.className = "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowUp_Over";this.over = true;main_self._canScrollUp = true;main_self._doScrollUp(this.pId, true);}
 arrow.onmouseout = function() {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);main_self.menuTimeoutHandler = window.setTimeout(function(){main_self._clearAndHide();}, main_self.menuTimeoutMsec, "JavaScript");}
 this.over = false;main_self._canScrollUp = false;if (this.className == "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowUp_Disabled")return;this.className = "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowUp";window.clearTimeout(main_self._scrollUpTM);}
 arrow.onclick = function(e) {e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 
 
 
 document.body.insertBefore(arrow, document.body.firstChild);this.idPull[arrow.id] = arrow;}
dhtmlXMenuObject.prototype._addDownArrow = function(id) {var main_self = this;var arrow = document.createElement("DIV");arrow.pId = this.idPrefix+id;arrow.id = "arrowdown_"+this.idPrefix+id;arrow.className = "dhtmlxMenu_"+this.skin+"_SubLevelArea_ArrowDown";arrow.innerHTML = "<div class='dhtmlxMenu_"+this.skin+"_SubLevelArea_Arrow'><div class='dhtmlxMenu_SubLevelArea_Arrow_Icon'></div></div>";arrow.style.display = "none";arrow.over = false;arrow.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 arrow.oncontextmenu = function(e) {e = e||event;e.returnValue = false;return false;}
 
 arrow.onmouseover = function() {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);}
 main_self._clearAllSelectedSubItemsInPolygon(this.pId);if (this.className == "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowDown_Disabled")return;this.className = "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowDown_Over";this.over = true;main_self._canScrollDown = true;main_self._doScrollDown(this.pId, true);}
 arrow.onmouseout = function() {if (main_self.menuMode == "web"){window.clearTimeout(main_self.menuTimeoutHandler);main_self.menuTimeoutHandler = window.setTimeout(function(){main_self._clearAndHide();}, main_self.menuTimeoutMsec, "JavaScript");}
 this.over = false;main_self._canScrollDown = false;if (this.className == "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowDown_Disabled")return;this.className = "dhtmlxMenu_"+main_self.skin+"_SubLevelArea_ArrowDown";window.clearTimeout(main_self._scrollDownTM);}
 arrow.onclick = function(e) {e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 document.body.insertBefore(arrow, document.body.firstChild);this.idPull[arrow.id] = arrow;}
dhtmlXMenuObject.prototype._removeUpArrow = function(id) {var fullId = "arrowup_"+this.idPrefix+id;this._removeArrow(fullId);}
dhtmlXMenuObject.prototype._removeDownArrow = function(id) {var fullId = "arrowdown_"+this.idPrefix+id;this._removeArrow(fullId);}
dhtmlXMenuObject.prototype._removeArrow = function(fullId) {var arrow = this.idPull[fullId];arrow.onselectstart = null;arrow.oncontextmenu = null;arrow.onmouseover = null;arrow.onmouseout = null;arrow.onclick = null;if (arrow.parentNode)arrow.parentNode.removeChild(arrow);arrow = null;this.idPull[fullId] = null;try {delete this.idPull[fullId];}catch(e) {}
}
dhtmlXMenuObject.prototype._isArrowExists = function(id) {if (this.idPull["arrowup_"+id] != null && this.idPull["arrowdown_"+id] != null)return true;return false;}
dhtmlXMenuObject.prototype._doScrollUp = function(id, checkArrows) {var polygon = this.idPull["polygon_"+id];if (this._canScrollUp && polygon.scrollTop > 0){var theEnd = false;var nextScrollTop = polygon.scrollTop - this._scrollUpTMStep;if (nextScrollTop < 0){theEnd = true;nextScrollTop = 0;}
 polygon.scrollTop = nextScrollTop;if (!theEnd){var that = this;this._scrollUpTM = window.setTimeout(function() {that._doScrollUp(id, false);}, this._scrollUpTMTime);}
 }else {this._canScrollUp = false;this._checkArrowsState(id);}
 if (checkArrows){this._checkArrowsState(id);}
}
dhtmlXMenuObject.prototype._doScrollDown = function(id, checkArrows) {var polygon = this.idPull["polygon_"+id];if (this._canScrollDown && polygon.scrollTop + polygon.offsetHeight <= polygon.scrollHeight){var theEnd = false;var nextScrollTop = polygon.scrollTop + this._scrollDownTMStep;if (nextScrollTop + polygon.offsetHeight > polygon.scollHeight){theEnd = true;nextScrollTop = polygon.scollHeight - polygon.offsetHeight;}
 polygon.scrollTop = nextScrollTop;if (!theEnd){var that = this;this._scrollDownTM = window.setTimeout(function() {that._doScrollDown(id, false);}, this._scrollDownTMTime);}
 }else {this._canScrollDown
 this._checkArrowsState(id);}
 if (checkArrows){this._checkArrowsState(id);}
}
dhtmlXMenuObject.prototype._countPolygonItems = function(id) {var count = 0;for (var a in this.itemPull){var par = this.itemPull[a]["parent"];var tp = this.itemPull[a]["type"];if (par == this.idPrefix+id && (tp == "item" || tp == "radio" || tp == "checkbox")) {count++;}
 }
 return count;}
dhtmlXMenuObject.prototype.setOverflowHeight = function(itemsNum) {if (itemsNum === "auto"){this.limit = 0;this.autoOverflow = true;return;}
 
 
 if (this.limit == 0 && itemsNum <= 0)return;this._clearAndHide();if (this.limit >= 0 && itemsNum > 0){this.limit = itemsNum;return;}
 
 
 if (this.limit > 0 && itemsNum <= 0){for (var a in this.itemPull){if (this._isArrowExists(a)) {var b = String(a).replace(this.idPrefix, "");this._removeUpArrow(b);this._removeDownArrow(b);this.idPull["polygon_"+a].style.height = "";}
 }
 this.limit = 0;return;}
}
dhtmlXMenuObject.prototype._getRadioImgObj = function(id) {try {var imgObj = this.idPull[this.idPrefix+id].childNodes[(this._rtl?2:0)].childNodes[0] }catch(e) {var imgObj = null;}
 return imgObj;}
dhtmlXMenuObject.prototype._setRadioState = function(id, state) {var imgObj = this._getRadioImgObj(id);if (imgObj != null){var rObj = this.itemPull[this.idPrefix+id];rObj["checked"] = state;rObj["imgen"] = "rdbt_"+(rObj["checked"]?"1":"0");rObj["imgdis"] = rObj["imgen"];imgObj.className = "sub_icon "+rObj["imgen"];}
}
dhtmlXMenuObject.prototype._radioOnClickHandler = function(id, type, casState) {if (type.charAt(1)=="d" || this.itemPull[this.idPrefix+id]["group"]==null) return;var group = this.itemPull[this.idPrefix+id]["group"];if (this.checkEvent("onRadioClick")) {if (this.callEvent("onRadioClick", [group, this.getRadioChecked(group), id, this.contextMenuZoneId, casState])) {this.setRadioChecked(group, id);}
 }else {this.setRadioChecked(group, id);}
 
 if (this.checkEvent("onClick")) this.callEvent("onClick", [id]);}
dhtmlXMenuObject.prototype.getRadioChecked = function(group) {var id = null;for (var q=0;q<this.radio[group].length;q++){var itemId = this.radio[group][q].replace(this.idPrefix, "");var imgObj = this._getRadioImgObj(itemId);if (imgObj != null){var checked = (imgObj.className).match(/rdbt_1$/gi);if (checked != null)id = itemId;}
 }
 return id;}
dhtmlXMenuObject.prototype.setRadioChecked = function(group, id) {if (this.radio[group] == null)return;for (var q=0;q<this.radio[group].length;q++){var itemId = this.radio[group][q].replace(this.idPrefix, "");this._setRadioState(itemId, (itemId==id));}
}
dhtmlXMenuObject.prototype.addRadioButton = function(mode, nextToId, pos, itemId, itemText, group, state, disabled) {if (this.context && nextToId == this.topId){}else {if (this.itemPull[this.idPrefix+nextToId] == null)return;if (mode == "child" && this.itemPull[this.idPrefix+nextToId]["type"] != "item")return;}
 
 
 
 var id = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var img = "rdbt_"+(state?"1":"0");var imgDis = img;if (mode == "sibling"){var parentId = this.idPrefix+this.getParentId(nextToId);this._addItemIntoGlobalStrorage(id, parentId, itemText, "radio", disabled, img, imgDis);this._renderSublevelItem(id, this.getItemPosition(nextToId));}else {var parentId = this.idPrefix+nextToId;this._addItemIntoGlobalStrorage(id, parentId, itemText, "radio", disabled, img, imgDis);if (this.idPull["polygon_"+parentId] == null){this._renderSublevelPolygon(parentId, parentId);}
 this._renderSublevelItem(id, pos-1);this._redefineComplexState(parentId);}
 
 var gr = (group!=null?group:this._genStr(24));this.itemPull[id]["group"] = gr;if (this.radio[gr]==null){this.radio[gr] = new Array();}
 this.radio[gr][this.radio[gr].length] = id;if (state == true)this.setRadioChecked(gr, String(id).replace(this.idPrefix, ""));}
dhtmlXMenuObject.prototype._getCheckboxState = function(id) {if (this.itemPull[this.idPrefix+id] == null)return null;return this.itemPull[this.idPrefix+id]["checked"];}
dhtmlXMenuObject.prototype._setCheckboxState = function(id, state) {if (this.itemPull[this.idPrefix+id] == null)return;this.itemPull[this.idPrefix+id]["checked"] = state;}
dhtmlXMenuObject.prototype._updateCheckboxImage = function(id) {if (this.idPull[this.idPrefix+id] == null)return;this.itemPull[this.idPrefix+id]["imgen"] = "chbx_"+(this._getCheckboxState(id)?"1":"0");this.itemPull[this.idPrefix+id]["imgdis"] = this.itemPull[this.idPrefix+id]["imgen"];try {this.idPull[this.idPrefix+id].childNodes[(this._rtl?2:0)].childNodes[0].className = "sub_icon "+this.itemPull[this.idPrefix+id]["imgen"];}catch(e){}
}
dhtmlXMenuObject.prototype._checkboxOnClickHandler = function(id, type, casState) {if (type.charAt(1)=="d") return;if (this.itemPull[this.idPrefix+id] == null)return;var state = this._getCheckboxState(id);if (this.checkEvent("onCheckboxClick")) {if (this.callEvent("onCheckboxClick", [id, state, this.contextMenuZoneId, casState])) {this.setCheckboxState(id, !state);}
 }else {this.setCheckboxState(id, !state);}
 
 if (this.checkEvent("onClick")) this.callEvent("onClick", [id]);}
dhtmlXMenuObject.prototype.setCheckboxState = function(id, state) {this._setCheckboxState(id, state);this._updateCheckboxImage(id);}
dhtmlXMenuObject.prototype.getCheckboxState = function(id) {return this._getCheckboxState(id);}
dhtmlXMenuObject.prototype.addCheckbox = function(mode, nextToId, pos, itemId, itemText, state, disabled) {if (this.context && nextToId == this.topId){}else {if (this.itemPull[this.idPrefix+nextToId] == null)return;if (mode == "child" && this.itemPull[this.idPrefix+nextToId]["type"] != "item")return;}
 
 var img = "chbx_"+(state?"1":"0");var imgDis = img;if (mode == "sibling"){var id = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var parentId = this.idPrefix+this.getParentId(nextToId);this._addItemIntoGlobalStrorage(id, parentId, itemText, "checkbox", disabled, img, imgDis);this.itemPull[id]["checked"] = state;this._renderSublevelItem(id, this.getItemPosition(nextToId));}else {var id = this.idPrefix+(itemId!=null?itemId:this._genStr(24));var parentId = this.idPrefix+nextToId;this._addItemIntoGlobalStrorage(id, parentId, itemText, "checkbox", disabled, img, imgDis);this.itemPull[id]["checked"] = state;if (this.idPull["polygon_"+parentId] == null){this._renderSublevelPolygon(parentId, parentId);}
 this._renderSublevelItem(id, pos-1);this._redefineComplexState(parentId);}
}
dhtmlXMenuObject.prototype._readLevel = function(parentId) {var xml = "";for (var a in this.itemPull){if (this.itemPull[a]["parent"] == parentId){var imgEn = "";var imgDis = "";var hotKey = "";var itemId = String(this.itemPull[a]["id"]).replace(this.idPrefix,"");var itemType = "";var itemText = (this.itemPull[a]["title"]!=""?' text="'+this.itemPull[a]["title"]+'"':"");var itemState = "";if (this.itemPull[a]["type"] == "item"){if (this.itemPull[a]["imgen"] != "")imgEn = ' img="'+this.itemPull[a]["imgen"]+'"';if (this.itemPull[a]["imgdis"] != "")imgDis = ' imgdis="'+this.itemPull[a]["imgdis"]+'"';if (this.itemPull[a]["hotkey"] != "")hotKey = '<hotkey>'+this.itemPull[a]["hotkey"]+'</hotkey>';}
 if (this.itemPull[a]["type"] == "separator"){itemType = ' type="separator"';}else {if (this.itemPull[a]["state"] == "disabled")itemState = ' enabled="false"';}
 if (this.itemPull[a]["type"] == "checkbox"){itemType = ' type="checkbox"'+(this.itemPull[a]["checked"]?' checked="true"':"");}
 if (this.itemPull[a]["type"] == "radio"){itemType = ' type="radio" group="'+this.itemPull[a]["group"]+'" '+(this.itemPull[a]["checked"]?' checked="true"':"");}
 xml += "<item id='"+itemId+"'"+itemText+itemType+imgEn+imgDis+itemState+">";xml += hotKey;if (this.itemPull[a]["complex"])xml += this._readLevel(a);xml += "</item>";}
 }
 return xml;}
dhtmlXMenuObject.prototype.serialize = function() {var xml = "<menu>"+this._readLevel(this.idPrefix+this.topId)+"</menu>";return xml;}
function dhtmlxSlider(base,size,skin,vertical,min,max,value,step){if (_isIE)try {document.execCommand("BackgroundImageCache", false, true);}catch (e){}
 var parentNod;if (base && typeof(base)=="object" && !base.nodeName){parentNod=base.parent;skin=base.skin;min=base.min;max=base.max
 step=base.step
 vertical=base.vertical
 value=base.value;size=base.size;}
 if (!base){var z="slider_div_"+(new Date()).valueOf()+Math.random(1000);parentNod = document.createElement ("div");parentNod.setAttribute ("id", z);var child = document.body.lastChild;while (child.lastChild && child.lastChild.nodeType == 1)child=child.lastChild;child.parentNode.insertBefore(parentNod,child);}
 else if (typeof(base)!="object")
 parentNod=document.getElementById(base);else
 parentNod = base;if (typeof(size)=="object"){skin=size.skin;min=size.min;max=size.max
 step=size.step
 vertical=size.vertical
 value=size.value;size=size.size;}
 this.size = size;this.vMode=vertical||false;this.skin = dhtmlx.skin || skin || "default";this.parent = parentNod;this.isInit = false;this.disabled = false;this.value = (value == "undefined"? (min || 0):value);this.inputPriority = true;this.stepping = false;this.imgURL = window.dhx_globalImgPath||dhtmlx.image_path||"";this._skinsImgs = 
 {"default": {ls:1,lz:1,rz:1,rs:1},
 ball: {ls:1,lz:1,rz:1,rs:1},
 zipper: {bg:1,lz:1,rz:1},
 arrow: {bg:1,ls:1,rs:1},
 arrowgreen: {bg:1,ls:1,rs:1},
 simplesilver:{lz:1,ls:1,rs:1,rz:1},
 simplegray: {lz:1,ls:1,rs:1,rz:1},
 bar: {bg:1,ls:1,rs:1},
 dhx_skyblue: {bg:1}
 };this._def = [min-0||0,max-0||100,step-0||1,value-0||0,size-0];dhtmlxEventable(this);return this;}
dhtmlxSlider.prototype.createStructure = function(){if (this.con){this.con.parentNode.removeChild(this.con);this.con = null;}
 if (this.vMode){this._sW="height";this._sH="width";this._sL="top";this._sT="left";var skinImgPath = this.imgURL+"skins/"+this.skin+"/vertical/";}else {this._sW="width";this._sH="height";this._sL="left";this._sT="top";var skinImgPath = this.imgURL+"skins/"+this.skin+"/";}
 this.con=document.createElement("DIV");this.con.onselectstart=function(){return false;};this.con._etype="slider";this.con.className = "dhtmlxSlider" + (this.skin!='default'?"_"+this.skin:"");if (this._skinsImgs[this.skin]['bg'])this.con.style.backgroundImage = "url("+skinImgPath+"bg.gif)";this.drag=document.createElement("DIV");this.drag._etype="drag";this.drag.className = "selector";this.drag.style.backgroundImage = "url("+skinImgPath+"selector.gif)";var leftSide = document.createElement("DIV");leftSide.className = "leftSide";if (this._skinsImgs[this.skin]['ls'])leftSide.style.background = "url("+skinImgPath+"leftside_bg.gif)";this.leftZone = document.createElement("DIV");this.leftZone.className = "leftZone";if (this._skinsImgs[this.skin]['lz'])this.leftZone.style.background = "url("+skinImgPath+"leftzone_bg.gif)";var rightSide = document.createElement("DIV");rightSide.className = "rightSide";if (this._skinsImgs[this.skin]['rs'])rightSide.style.background = "url("+skinImgPath+"rightside_bg.gif)";this.rightZone = document.createElement("DIV");this.rightZone.className = "rightZone";if (this._skinsImgs[this.skin]['rz'])this.rightZone.style.background = "url("+skinImgPath+"rightzone_bg.gif)";this.con.appendChild(leftSide);this.con.appendChild(this.leftZone);this.con.appendChild(this.rightZone);this.con.appendChild(rightSide);this.con.appendChild(this.drag);this.parent.appendChild(this.con);if (!this.parent.parentNode || !this.parent.parentNode.tagName)document.body.appendChild(this.parent);if (this.vMode){this._sW="height";this._sH="width";this._sL="top";this._sT="left";this.con.style.width = this.con.offsetHeight + 'px';for (var i=0;i<this.con.childNodes.length;i++){this.con.childNodes[i].style.fontSize = "0";var tmp = this.con.childNodes[i].offsetWidth;this.con.childNodes[i].style.width = this.con.childNodes[i].offsetHeight + 'px';this.con.childNodes[i].style.height = tmp + 'px';tmp = this.con.childNodes[i].offsetLeft;this.con.childNodes[i].style.left = this.con.childNodes[i].offsetTop + 'px';this.con.childNodes[i].style.top = tmp + 'px';}
 rightSide.style.top = this.size - rightSide.offsetHeight + 'px';this.zoneSize = this.size - rightSide.offsetHeight;this.dragLeft = this.drag.offsetTop;this.dragWidth = this.drag.offsetHeight;this.rightZone.style.height = this.zoneSize + 'px';}else {this.zoneSize = this.size - rightSide.offsetWidth;this.dragLeft = this.drag.offsetLeft;this.dragWidth = this.drag.offsetWidth;this.rightZone.style.width = this.zoneSize + 'px';}
 this.con.style[this._sW] = this.size+"px";this.con.onmousedown=this._onMouseDown;this.con.onmouseup = this.con.onmouseout = function () {clearInterval (this.that._int)}
 this.con.that = this;this._aCalc(this._def);}
dhtmlxSlider.prototype._aCalc=function(def){if (!this.isInit)return;this.shift=def[0];this.limit=def[1]-this.shift;this._mod=(def[4]-this.dragLeft*2-this.dragWidth)/this.limit;this._step=def[2];this.step=this._step*this._mod;this._xlimit=def[4]-this.dragLeft*2-this.dragWidth;if (!this.posX){this.posX=this._xlimit*(def[3]-this.shift)/this.limit;}
 this._applyPos(true);return this;}
dhtmlxSlider.prototype.setMin=function(val){this._def[0] = val-0;this._aCalc(this._def);}
dhtmlxSlider.prototype.setMax=function(val){this._def[1] = val-0;this._aCalc(this._def);}
dhtmlxSlider.prototype.setStep=function(val){this._def[2] = val-0;this._aCalc(this._def);}
dhtmlxSlider.prototype._applyPos=function(skip){if (!this.isInit)return;if (this.step!=1&&this.step)this.posX=Math.round(this.posX/this.step)*this.step;if (this.posX<0)this.posX=0;if (this.value < (this._def[0] || 0))
 this.value = this._def[0] || 0;if (this.value > this._def[1])this.value = this._def[1];if (this.posX>this._xlimit)this.posX=this._xlimit;var a_old=this.drag.style[this._sL];this.drag.style[this._sL]=this.posX+this.dragLeft*1+"px";this.leftZone.style[this._sW]=this.posX+this.dragLeft*1+"px";this.rightZone.style[this._sL]=this.posX+this.dragLeft*1+1+"px";this.rightZone.style[this._sW]=this.zoneSize-(this.posX+this.dragLeft*1)+"px";var nw=this.getValue();if (this._link){if (this._linkBoth)this._link.value=nw;else
 this._link.innerHTML=nw;}
 if (!skip&&a_old!=this.drag.style[this._sL])this.callEvent("onChange",[nw,this]);this.value = this.getValue ();if(!this._dttp)this._setTooltip(nw);}
dhtmlxSlider.prototype._setTooltip=function(nw){this.con.title=nw;}
dhtmlxSlider.prototype.setSkin=function(skin) {this.skin = skin||"default";if (this.isInit)this.createStructure();}
dhtmlxSlider.prototype.startDrag = function(e) {if (this._busy)return;if ((e.button === 0)|| (e.button === 1)) {this.drag_mx = e.clientX;this.drag_my = e.clientY;this.drag_cx = this.posX;this.d_b_move = document.body.onmousemove;this.d_b_up = document.body.onmouseup;var _c=this;document.body.onmouseup = function(e){_c.stopDrag(e||event);_c=null;}
 document.body.onmousemove = function (e) {_c.onDrag(e||event);}
 this._busy=true;}
}
dhtmlxSlider.prototype.onDrag = function(e) {if (this._busy){if (!this.vMode)this.posX = this.drag_cx + e.clientX - this.drag_mx;else
 this.posX = this.drag_cx + e.clientY - this.drag_my;this._applyPos();}
}
dhtmlxSlider.prototype.stopDrag = function(e) {document.body.onmousemove = this.d_b_move?this.d_b_move:null;document.body.onmouseup = this.d_b_up?this.d_b_up:null;this.d_b_move=this.d_b_up=null;this._busy=false;this.callEvent("onSlideEnd",[this.getValue()])
}
dhtmlxSlider.prototype.getValue=function(){if ((!this._busy)&& (this.inputPriority))
 return (Math.round (this.value / this._step) * this._step).toFixed(6)-0;return Math.round((Math.round((this.posX/this._mod)/this._step)*this._step+this.shift*1)*10000)/10000;};dhtmlxSlider.prototype.setValue=function(val, skip){if (isNaN(val)) return;this._def[3] = this.value = val-0;this.posX=(Math.round(((val||0)-this.shift)*this._mod))
 this._applyPos(skip==null?true:skip);};dhtmlxSlider.prototype._getActionElement=function(nod){if (nod._etype)return nod;if (nod.parentNode)return this._getActionElement(nod.parentNode);return null;}
dhtmlxSlider.prototype._onMouseDown=function(e){if(this.that.disabled)return;e=e||event;var that=this.that;var nod=that._getActionElement(_isIE?e.srcElement:e.target);switch (nod._etype){case "slider":
 if (that.vMode)var z=e.clientY-(getAbsoluteTop(that.con)-document.body.scrollTop);else
 var z=e.clientX-(getAbsoluteLeft(that.con)-document.body.scrollLeft);var posX = that.posX;that.posX = z-that.dragLeft-that.dragWidth/2;that.direction = that.posX > posX ? 1 : -1;if (that.stepping){clearInterval (that._int);that.setValue (that.value + that._step * that.direction, false);that._int = setInterval (function () {that.setValue (that.value + that._step * that.direction, false)}, 600);}
 else 
 {that._busy=true;that._applyPos();that._busy = false;}
 break;case "drag":
 that.startDrag(e||event);break;}
 return false;}
dhtmlxSlider.prototype.setOnChangeHandler=function(func){this.attachEvent("onChange",func);}
dhtmlxSlider.prototype._linkFrom=function(){if(this.disabled)return;this.setValue (parseFloat (this._link.value), false);};dhtmlxSlider.prototype.linkTo=function(obj){obj = (typeof(obj) != "object") ? document.getElementById(obj) : obj;this._link = obj;var name=obj.tagName.toString().toLowerCase();this._linkBoth=(((name=="input")||(name=="select")||(name=="textarea"))?1:0);if (this._linkBoth){var self=this;var f=function(){if (this._nextSlider)window.clearTimeout(this._nextSlider);this._nextSlider=window.setTimeout(function(){self._linkFrom()},500);};obj.onblur=obj.onkeypress=obj.onchange=f;}
 this._applyPos();}
dhtmlxSlider.prototype.enableTooltip=function(mode){this._dttp=(!convertStringToBoolean(mode));this._setTooltip(this._dttp?"":this.getValue());}
dhtmlxSlider.prototype.setImagePath = function(path){this.imgURL = path;}
dhtmlxSlider.prototype.init = function() {this.isInit = true;this.createStructure();}
dhtmlxSlider.prototype.setInputPriority = function (mode) {this.inputPriority = mode;}
dhtmlxSlider.prototype.setSteppingMode = function (mode) {this.stepping = mode;}
dhtmlxSlider.prototype.disable = function (mode) {this.disabled = mode;};(function(){dhtmlx.extend_api("dhtmlxSlider",{_init:function(obj){return [ obj.parent, obj.size, obj.skin, obj.vertical, obj.min, obj.max, obj.value, obj.step ];},
 link:"linkTo"
 },{});})();function dhtmlXTabBar(parentObject,mode,height){mode=mode||"top"
 dhtmlxEventable(this);this._hrefs = {};this._s={};this._c={};this._s.mode=mode;this._s.scrolls=true;this._custom_height = height;this._s.line_height=(parseInt(height)||20)+3;this._s.skin_line = 1;this._s.tab_margin = 0;this._s.expand = 0;this._s.ext_border = 2;this._s._bMode=(mode=="right"||mode=="bottom")?1:0;this._s._vMode=(mode=="right"||mode=="left")?1:0;this._dx=this._s._vMode?"height":"width";this._dy=this._s._vMode?"width":"height";switch(mode){case "top":
 this._py="top";this._px="left";this._pxc="right";break;case "bottom":
 this._py="bottom";this._px="left";this._pxc="right";break;case "right":
 this._py="right";this._px="top";this._pxc="bottom";break;case "left":
 this._py="left";this._px="top";this._pxc="bottom";break;}
 
 
 this._active= null;this._tabs = {};this._content = {};this._href={}
 this._rows=[];this._s._tabSize=150;this._styles={"default":{left:3, right:3, select_shift:3, select_top:2, margin:1, offset:5, tab_color:"#F4F3EE", data_color:"#F0F8FF" },
 "winbiscarf":{left:18, right:18, select_shift:3, select_top:2, margin:1, offset:5},
 "winscarf":{left:18, right:4, select_shift:3, select_top:2, margin:5, offset:5},
 "modern":{left:5, right:5, select_shift:3, select_top:2, margin:1, offset:5, tab_color:"#F4F3EE", data_color:"#F0F8FF" },
 "silver":{left:7, right:7, select_shift:3, select_top:2, margin:1, offset:5, tab_color:"#F4F3EE", data_color:"#F0F8FF" },
 "dark_blue":{left:2, right:2, select_shift:3, select_top:2, margin:1, offset:5 },
 "glassy_blue":{left:2, right:3, select_shift:3, select_top:2, margin:1, offset:5 },
 "dhx_terrace":{left:7, right:7, select_shift:0, select_top:0, margin:-1, offset:0, tab_color:"", data_color:"#ffffff" },
 
 "dhx_black":{left:2, right:2, select_shift:3, select_top:0, margin:1, offset:5},
 "dhx_blue":{left:2, right:2, select_shift:3, select_top:0, margin:1, offset:5, tab_color:"#F4F3EE", data_color:"#F0F8FF" },
 "dhx_skyblue":{left:3, right:3, select_shift:0, select_top:0, margin:-1, offset:5 , data_color:"white", hover:true },
 "dhx_web":{left:3, right:3, select_shift:1, select_top:0, margin:5, offset:15 , data_color:"white" }
 };if (typeof(parentObject)!="object")
 parentObject = document.getElementById(parentObject);this.entBox=parentObject;this.entBox.className+=" dhx_tabbar_zone_"+this._s.mode;if (dhtmlx.image_path)this.setImagePath(dhtmlx.image_path);this.setStyle("default");this.__skin = false;this._createSelf();if (_isIE)this.preventIECashing(true);return this;}
dhtmlXTabBar.prototype={_get_size:function(name,alter){var size = this.entBox.getAttribute(name) || this.entBox.style[name] || (window.getComputedStyle?window.getComputedStyle(this.entBox,null)[name]:(this.entBox.currentStyle?this.entBox.currentStyle[name]:0))
 if ((size||"").indexOf("%")!=-1)
 this.enableAutoReSize(true,true);if (!size||size.indexOf("%")!=-1||size=="auto")
 size=alter+"px";return size;},
 
 setStyle:function(name){this.setSkin(name);},
 _getSkin:function(tab){return this._a;},
 
 setSkin:function(name){name=name.toLowerCase();if (!this._styles[name])name="default";this._a=this._styles[name];this.skin=name;if (this._tabAll)this._tabAll.className='dhx_tabbar_zone dhx_tabbar_zone_'+this.skin;var sky_mode = name.indexOf("dhx_sky")==0;var simple_mode = name.indexOf("dhx_web")==0;var terrace_mode = name.indexOf("dhx_terrace")==0;if (terrace_mode&&!this._custom_height){this._s.line_height = 37;this._setRowSizes();}
 if (sky_mode)this._s.skin_line=0;if (simple_mode){this._s.line_height = 29;this._s.ext_border = -1;this._s.expand = true;}
 if (sky_mode){this._s.line_height=26;this._setRowSizes();if (this._s.expand)this._s.tab_margin = -1;this._s.skin_line_x=true;this._s.skin_line=-3;var r = this._s._rendered;if (r)for (var i=0;i < r.length;i++){r[i].parentNode.removeChild(r[i]);}
 
 var d1 = document.createElement("DIV");d1.className="dhx_tabbar_lineA";this._tabAll.appendChild(d1);var d2 = document.createElement("DIV");d2.className="dhx_tabbar_lineB";this._tabAll.appendChild(d2);var d3 = document.createElement("DIV");d3.className="dhx_tabbar_lineC";this._tabAll.appendChild(d3);var d4 = document.createElement("DIV");d4.className="dhx_tabbar_lineD";this._tabAll.appendChild(d4);this._getCoverLine();this._s._rendered = [d1,d2,d3,d4];if (this._s.expand){this._conZone.style.borderWidth="0px 0px 0px 0px";this._tabZone.firstChild.style.borderWidth="0px 0px 0px 0px";d3.style.borderWidth="0px 0px 0px 0px";d4.style.left="0px";d3.style.right="0px";d1.style.borderWidth="0px 0px 0px 0px";if (this._s.mode=="top")this._lineA.style.borderWidth="1px 0px 0px 0px";d2.style.left = "1px"

 this._s.ext_border = 0;}
 
 var f = function(){this._lineA.style[this._dx]="1px";var _quirks=(_isIE && document.compatMode == "BackCompat");var w = this._tabAll[this._s._vMode?"offsetHeight":"offsetWidth"]+(_quirks?2:0);if (this._lastActive)w=Math.max(w,this._lastActive.parentNode[this._s._vMode?"scrollHeight":"scrollWidth"]);if (w<6)return;d1.style[this._py]=parseInt(this._conZone.style[this._py])-3+"px";d1.style[this._dx]=w-2+"px";d2.style[this._py]=parseInt(this._conZone.style[this._py])-3+"px";d2.style[this._dx]=w-(_quirks?6:4)+(this._s.expand?2:0)+"px";d3.style[this._dy]=parseInt(this._tabZone.style[this._dy])-3+"px";this._lineA.style[this._dx]=w-2+"px";}
 f.call(this);var bf = this._checkScroll;this._checkScroll=function(){f.apply(this,arguments);bf.apply(this,arguments);}
 var bs = this._scrollTo;this._scrollTo=function(){bs.apply(this,arguments);f.apply(this,arguments);}
 
 }
 if (this._a.data_color && this._conZone)this._conZone.style.backgroundColor=this._a.data_color;this.__skin = true;},

 
 enableAutoReSize:function(){var self=this;dhtmlxEvent(window,"resize",function(){window.setTimeout(function(){if (self && self._setSizes)self._setSizes();},1) 
 })
 },
 _createSelf:function(){this._tabAll=document.createElement("DIV");this._tabZone=document.createElement("DIV");this._conZone=document.createElement("DIV");this.entBox.appendChild(this._tabAll);this._tabAll.appendChild(this._tabZone);this._tabAll.appendChild(this._conZone);this._tabAll.className='dhx_tabbar_zone dhx_tabbar_zone_'+this.skin;if (this._s._vMode)this._tabAll.className+='V';if (this._s._bMode)this._tabAll.className+='B';this._tabZone.className='dhx_tablist_zone';this._conZone.className='dhx_tabcontent_zone';if (this.entBox._hideBorders){this._conZone.style.borderLeft = this._conZone.style.borderRight = this._conZone.style.borderBottom = "0px solid white";}
 if (this._a.data_color)this._conZone.style.backgroundColor=this._a.data_color;this._tabZone.onselectstart = function(){return false;};this._tabZone.onclick = this._onClickHandler;this._tabZone.onmouseover = this._onMouseOverHandler;this._tabZone[_isFF?"onmouseout":"onmouseleave"] = this._onMouseOutHandler;this._tabZone.tabbar=this;this._createRow();},
 _createRow:function(){var z=document.createElement("DIV");z.className='dhx_tabbar_row';z.tabCount=0;this._tabZone.appendChild(z);this._rows[this._rows.length]=z;this._setRowSizes();},
 _removeRow:function(row){row.parentNode.removeChild(row);var z=[];for (var i=0;i<this._rows.length;i++)if (this._rows[i]!=row)z[z.length]=this._rows[i];this._rows=z;},
 _setSizes:function(x,y){var dim=["clientHeight","clientWidth"];if (this._dx!="width")dim.reverse();var _quirks=(_isIE && document.compatMode == "BackCompat");var outerBorder=(this._conZone.offsetWidth-this._conZone.clientWidth);var _h=y||(this.entBox[dim[0]]+(_quirks?outerBorder:0));var _w=x||(this.entBox[dim[1]]+(_quirks?outerBorder:0));var _t=this._rows.length*(this._s.line_height-(this._s.skin_line_x?4:2))+(this._s.skin_line_x?2:0);this._tabZone.style[this._dy]=_t+"px";this._conZone.style[this._dy]=Math.max(0,_h-this._s.ext_border-_t-(this._s.skin_line_x?3:0)-this._s.tab_margin)+"px";this._conZone.style[this._dx]=Math.max(0,_w - (this._s.expand?0:2))+"px";this._tabZone.style[this._py]=this._s.tab_margin+"px";this._conZone.style[this._py]=_t+this._s.tab_margin-this._s.skin_line+"px";this._checkScroll();var id = this.getActiveTab();if (id)this.cells(id).activate();},
 _checkScroll:function(){if (this._lineA){this._lineA.style[this._dx]="1px";var _quirks=(_isIE && document.compatMode == "BackCompat");var w = this._tabAll[this._s._vMode?"offsetHeight":"offsetWidth"]+(_quirks?2:0);if (this._lastActive)w=Math.max(w,this._lastActive.parentNode[this._s._vMode?"scrollHeight":"scrollWidth"]);if (w>2)this._lineA.style[this._dx]=w-2+"px";}
 

 if (this._s._vMode || !this._s.scrolls)return;for (var i=0;i<this._rows.length;i++)if ((this._rows[i].scrollWidth-this._rows[i].offsetWidth)>2)
 this._showScroll(i);else this._hideScroll(i);},

 _showScroll:function(i){if (this._rows[i]._scroll)return;this.callEvent("onBeforeShowScroll",[i]);var a=this._rows[i]._scroll=[];var top = Math.max(0,this._s.line_height-23);a[0]=document.createElement("DIV");a[0].style.cssText="background-image:url("+this.imgUrl+this.skin+"/"+this.skin+"_scroll_left.gif);width:20px;height:21px;position:absolute;left:0px;z-index:990;top:"+top+"px;";a[0].className="dhx_tab_scroll_left";this._rows[i].appendChild(a[0]);a[1]=document.createElement("DIV");a[1].style.cssText="background-image:url("+this.imgUrl+this.skin+"/"+this.skin+"_scroll_right.gif);width:20px;height:21px;position:absolute;right:0px;z-index:990;top:"+top+"px;";a[1].className="dhx_tab_scroll_right";this._rows[i].appendChild(a[1]);},
 _hideScroll:function(i){if(this._rows[i]._scroll){this.callEvent("onBeforeHideScroll",[i]);}
 if (!this._rows[i]._scroll)return;this._rows[i].removeChild(this._rows[i]._scroll[0])
 this._rows[i].removeChild(this._rows[i]._scroll[1])
 this._rows[i]._scroll=null;},

 _setRowSizes:function(){for (var i=0;i<this._rows.length;i++){this._rows[i].style[this._dy]=this._s.line_height+"px";this._rows[i].style[this._py]=i*(this._s.line_height-(this._s.skin_line_x?4:2))-((_isIE && !window.postMessage && this._s._bMode)?0:0)+"px";this._rows[i].style.zIndex=10+i;}
 this._setSizes();},
 _setTabSizes:function(row){var pos=this._a.offset;var px = this._s.align?this._pxc:this._px;for (var i=0;i < row.tabCount;i++){var tab=row.childNodes[i];if (tab.style.display=="none")continue;tab.style[px]=pos-(this._lastActive==tab?this._a.select_shift:0)+"px";pos+=tab._size+this._a.margin;}
 },

 
 addTab:function(id, text, size, position, row){if (!this.__skin && dhtmlx.skin)this.setSkin(dhtmlx.skin);row=row||0;for (var i=this._rows.length;i<=row;i++)this._createRow();var z=this._rows[row].tabCount;if ((!position)&&(position!==0)) position=z;var tab=this._createTab(id, text, (size=="*"?10:size||this._s._tabSize));this._addTab(this._rows[row],tab,size,position);this._tabs[id]=tab;this.cells(id).hide();this._checkScroll();},

 
 removeTab:function(id,mode){var tab=this._tabs[id];if (!tab)return;this.cells(id)._dhxContDestruct();if (this._content[id] && this._content[id].parentNode)this._content[id].parentNode.removeChild(this._content[id]);this._content[id]=null;this._goToAny(tab,mode);var row=tab.parentNode;tab.innerHTML = "";row.removeChild(tab);row.tabCount--;if ((row.tabCount==0)&&(this._rows.length>1))
 this._removeRow(row);else
 this._setTabSizes(row);delete this._tabs[id];if (this._lastActive==tab)this._lastActive=null;this._setRowSizes();},
 _goToAny:function(tab,mode){if (this._lastActive==tab){if (mode && this.goToNextTab()==tab)
 this.goToPrevTab();if (this._lastActive==tab)this._lastActive=null;}
 },
 _createTab:function(id,text,size){var tab=document.createElement("DIV");tab.className='dhx_tab_element dhx_tab_element_inactive';var thml="<span>"+text+"</span><div></div><div></div><div></div>";if (this._close)thml+="<IMG style='"+this._pxc+":4px;"+this._py+(this.skin=="dhx_web"?":7":":4")+"px;position:absolute;z-index:11;' src='"+this.imgUrl+this.skin+"/close.png' >";tab.innerHTML=thml;tab.setAttribute("tab_id",id);tab._size=parseInt(size);tab.style[this._dx]=parseInt(size)+"px";tab.style[this._dy]=this._s.line_height+"px";tab.style[this._py]=this._a.select_top+"px";tab.skin=this.skin;if (this._a.tab_color)tab.style.backgroundColor=this._a.tab_color;if (this._c[id])tab.childNodes[0].style.cssText=this._c[id].color;this._img_all(tab);if (this._close){var self=this;tab.childNodes[4].onclick=function(e){var id=this.parentNode.getAttribute("tab_id");if (self.callEvent("onTabClose",[id])) self.removeTab(id,true);(e||event).cancelBubble=true;};}
 return tab;},
 _img_all:function(tab){var a=this._getSkin(tab);var pf=tab._active?1:4;this._img(tab.childNodes[1],pf,this._px,a.left);this._img(tab.childNodes[2],pf+2,this._pxc,a.right);this._img(tab.childNodes[3],pf+1,this._px,parseInt(tab.style[this._dx])-(a.left+a.right),a.left);},
 _get_img_pos:function(ind){if (this._s._bMode && ind<7)ind=Math.abs(ind-6);ind=-5-ind*(this._s._vMode==1&&this.skin=="dhx_terrace"?245:45);if (this._s._vMode)return ind+"px 0px";else return "0px "+ind+"px";},
 _img:function(tag,y,pos,a,b){if (typeof(tag)== "undefined")
 return;tag.style.backgroundImage="url("+this.imgUrl+this.skin+"/"+this.skin+"_"+this._s.mode+".gif)";tag.style.backgroundPosition=this._get_img_pos(y);if (this._s._vMode == 1 && this.skin == "dhx_terrace")tag.style.width="240px";tag.style[this._py]="0px";if (pos){tag.style[this._dx]=Math.max(a,0)+"px";tag.style[pos]=(b||0)+"px";}
 
 },
 _addTab:function(row,tab,size,position){var pos=this._a.offset;if (row.tabCount){var last=row.childNodes[row.tabCount-1];var pos=parseInt(last.style[this._s.align?this._pxc:this._px])+parseInt(last._size)+this._a.margin;}
 
 var next=row.childNodes[position];if (next)row.insertBefore(tab,next)
 else
 row.appendChild(tab);row.tabCount++;if (size=="*"){tab.style.whiteSpace="nowrap";this.adjustTabSize(tab);}
 
 tab.style[this._s.align?this._pxc:this._px]=pos+"px";if (position!=row.tabCount-1)this._setTabSizes(row);},
 adjustTabSize:function(tab,size){var a=this._getSkin(a);if (!size){tab.style.fontWeight="bold";tab.childNodes[3].style[this._dx] = tab.style[this._dx]="10px";size=tab[this._s._vMode?"scrollHeight":"scrollWidth"]+10+(this._close?20:0);tab.style.fontWeight="";}
 tab.style[this._dx]=size+"px";tab._size=size;this._img_all(tab);},
 _onMouseOverHandler:function(e){var target = this.tabbar._getTabTarget(e?e.target:event.srcElement);this.tabbar._showHover(target);},
 _onMouseOutHandler:function(e){this.tabbar._showHover();},
 _showHover:function(tab){if (tab==this._lastHower)return;if (this._lastHower && this._lastHower != this._lastActive){var a=this._getSkin(this._lastHower);this._lastHower.className=this._lastHower.className.replace(/[ ]*dhx_tab_hover/gi,"");if (a.hover)this._img_all(this._lastHower);else
 this._img(this._lastHower.childNodes[3],5,this._px,parseInt(this._lastHower.style[this._dx])-(a.left+a.right),a.left);this._lastHower=null;}
 if (tab && ( tab == this._lastActive || tab._disabled)) return;this._lastHower=tab;if(tab){var a=this._getSkin(tab);tab.className+=" dhx_tab_hover";if (a.hover){this._img(tab.childNodes[1],7,this._px,a.left);this._img(tab.childNodes[2],8,this._pxc,a.right);}
 this._img(tab.childNodes[3],0,this._px,parseInt(tab.style[this._dx])-(a.left+a.right),a.left);}
 
 },
 _getTabTarget:function(t){if (!t)return null;while ((!t.className)||(t.className.indexOf("dhx_tab_element")==-1)){if ((t.className)&&(t.className.indexOf("dhx_tabbar_zone")!=-1)) return null;t=t.parentNode;if (!t)return null;}
 return t;},
 _onClickHandler:function(e){var src=e?e.target:event.srcElement;var target = this.tabbar._getTabTarget(src);if (target && !target._disabled)this.tabbar._setTabActive(target);else {var tag=null;if (src.className=="dhx_tab_scroll_left"){src.parentNode.scrollLeft=Math.max(0,src.parentNode.scrollLeft-src.parentNode.offsetWidth/2);tag=src;this.tabbar._setTabTop(this.tabbar._lastActive);}
 else if (src.className=="dhx_tab_scroll_right"){src.parentNode.scrollLeft+=src.parentNode.offsetWidth/2;tag=src.previousSibling;this.tabbar._setTabTop(this.tabbar._lastActive);}
 if (tag && tag.parentNode&&tag.parentNode.tagName){tag.style.left=tag.parentNode.scrollLeft+"px";if (!_isIE || window.XMLHttpRequest)tag.nextSibling.style.right=tag.parentNode.scrollLeft*(-1)+"px";return false;}
 }
 },
 _deactivateTab:function(){this._setTabInActive(this._lastActive);this._lastActive=null;},
 _setTabInActive:function(tab,mode){if (!tab || tab!=this._lastActive)return true;var a = this._getSkin(tab);var id = tab.getAttribute("tab_id");var px = this._s.align?this._pxc:this._px;tab.className=tab.className.replace("_active","_inactive");tab.style[this._py]=a.select_top+"px";tab.style[px]=parseInt(tab.style[px])+a.select_shift+"px";tab.style[this._dx]=tab._size+"px";tab._active=false;if (a.tab_color)tab.style.backgroundColor=a.tab_color;if (this._c[id])tab.childNodes[0].style.cssText=this._c[id].color;this._img_all(tab);this.cells(id).hide();},
 _setTabActive:function(tab,mode){if (!tab)return true;var id = tab.getAttribute("tab_id");var last_id = this._lastActive?this._lastActive.getAttribute("tab_id"):null;var a = this._getSkin(tab);if (!mode)this.callEvent("onTabClick",[id,last_id]);if( tab==this._lastActive)return true;if (!mode)if (!this.callEvent("onSelect",[id,last_id])) return;var px = this._s.align?this._pxc:this._px;this._setTabInActive(this._lastActive);tab.className=tab.className.replace("_inactive","_active");tab.style[this._py]="0px";tab.style[px]=parseInt(tab.style[px])-a.select_shift+"px";tab.style[this._dx]=tab._size+a.select_shift*2+"px";tab._active=true;if (a.data_color)tab.style.backgroundColor=a.data_color;if (this._c[id])tab.childNodes[0].style.cssText=this._c[id].scolor;this._img_all(tab);this._setTabTop(tab);this._lastActive=tab;this.cells(id).show();this._scrollTo(tab);return true;},
 _scrollTo:function(tab){if (!this._s.scrolls)return;if (tab.offsetLeft<tab.parentNode.scrollLeft || (tab.offsetLeft+tab.offsetWidth)>(tab.parentNode.scrollLeft+tab.parentNode.offsetWidth)){tab.parentNode.scrollLeft = tab.offsetLeft;var tag = tab.parentNode._scroll;if (tag && tag[0]){tag[0].style.left=tag[0].parentNode.scrollLeft+"px";if (!_isIE || window.XMLHttpRequest)tag[1].style.right=tag[1].parentNode.scrollLeft*(-1)+"px";}
 }
 },
 _setTabTop:function(tab){if(!tab)return false;var t = this._rows.length-1;for (var i=0;i<this._rows.length;i++)if (this._rows[i]==tab.parentNode){var row=this._rows[i];if (i!=t){this._rows[i]=this._rows[t]
 this._rows[t]=row;}
 var line=this._getCoverLine();row.appendChild(line);line.style[this._dx]="1px";var wh=(this._s._vMode?Math.max(this._tabZone.offsetHeight,row.scrollHeight):Math.max(this._tabZone.offsetWidth,row.scrollWidth));if (wh>0)line.style[this._dx]=wh+"px";tab.style.zIndex=(line._index++);break;}
 this._setRowSizes();},
 _getCoverLine:function(){if (!this._lineA){this._lineA=document.createElement("div");this._lineA.className="dhx_tablist_line";this._lineA.style[this._py]=this._s.line_height-3-(this._s.skin_line_x?1:0)+"px";this._lineA.style[this._dx]="100%";this._lineA._index=1;}
 this._lineA.style.zIndex=(this._lineA._index++);return this._lineA;},
 cells:function(id){if (!this._tabs[id])return null;if (!this._content[id]){var d=document.createElement("DIV");d.style.cssText="width:100%;height:100%;visibility:hidden;overflow:hidden;position:absolute;top:0px;left:0px;";d.setAttribute("tab_id",id);d.skin = this.skin;this._conZone.appendChild(d);(new dhtmlXContainer(d)).setContent(d);if (this.skin=="dhx_web" && d._setPadding)d._setPadding(1, "dhxcont_tabbar_dhx_web");d._isTabbarCell = true;this._content[id]=d;var self=this;d.show = function(){if (self._s.hide)this.style.display="";this.style.visibility="";this.style.zIndex="1";this.autoSize();this._activate();}
 d.hide = function(){if (self._s.hide){this.style.visibility="";this.style.display="none";}else
 this.style.visibility="hidden";this.style.zIndex=-1;if (self._hrfmode=="iframe")this.attachURL("javascript:false");}
 d.autoSize = function(){if (self._awdj || self._ahdj){var cont = (this.vs?this.vs[this.av].dhxcont.mainCont[this.av]:this.mainCont);if (!cont.offsetWidth)cont.style.width=Math.max(0,self.entBox.offsetWidth - 2)+"px";if (self._ahdj)cont.style.height="1px";var dim = this._getContentDim();if (self._awdj){self.entBox.style.width=dim[0]+2+"px";cont.style.width=dim[0]+"px";}
 if (self._ahdj){self._tabAll.style.height = self.entBox.style.height=dim[1]+self._rows.length*(self._s.line_height-2)+(self._s.expand?0:2)+2+"px";cont.style.height=dim[1]+"px";}
 self._setSizes();self._setTabTop(self._lastActive);}
 };d._activate=function(){if (this._delay)this._attachContent.apply(this,this._delay);this.activate();if (self._hrfmode!="iframe")this._delay=null;};d._doOnResize=function(){this.activate();};d.activate=function(){this.adjustContent(this.parentNode,0,0,false,0);d.updateNestedObjects();}
 d._doOnAttachStatusBar = d.activate;d._doOnAttachMenu = d.activate;d._doOnAttachToolbar = d.activate;d._getContentDim=function(){var cont = (this.vs?this.vs[this.av].dhxcont.mainCont[this.av]:this.mainCont);return [cont.scrollWidth,cont.scrollHeight];}
 d._doOnFrameContentLoaded=function(){if (self._awdj || self._ahdj)self.cells(id).autoSize();self.callEvent("onXLE",[]);self.callEvent("onTabContentLoaded",[this.getAttribute("tab_id")]);}
 d._doOnBeforeAttachURL=function(){self.callEvent("onXLS",[]);}
 d.adjustContent(d.parentNode,0,0,false,0);}
 return this._content[id];},

 
 forceLoad:function(id,href){this.setContentHref(id,href||this._hrefs[id]);this.cells(id)._activate();},
 
 
 

 
 enableAutoSize:function(autoWidth,autoHeight){this._ahdj=convertStringToBoolean(autoHeight);this._awdj=convertStringToBoolean(autoWidth);},
 

 
 clearAll:function(){for (var id in this._tabs)this.removeTab(id,false);if (this._lineA){var line=this._getCoverLine();if (line.parentNode)line.parentNode.removeChild(line);}
 },

 
 enableTabCloseButton:function(mode){this._close = convertStringToBoolean(mode);}, 
 
 
 preventIECashing:function(mode){this.no_cashe = convertStringToBoolean(mode);if (this.XMLLoader)this.XMLLoader.rSeed=this.no_cashe;},

 setTabActive:function(id,mode){this._setTabActive(this._tabs[id],mode===false);},
 setTabInActive:function(){var tab = this._lastActive;if (tab){this._deactivateTab();this._setTabTop(tab);this._getCoverLine();}
 },

 
 loadXMLString:function(xmlString,call){this.XMLLoader=new dtmlXMLLoaderObject(this._parseXML,this,true,this.no_cashe);this.XMLLoader.waitCall=call||0;this.XMLLoader.loadXMLString(xmlString);},

 
 loadXML:function(url,call){this.callEvent("onXLS",[]);this.XMLLoader=new dtmlXMLLoaderObject(this._parseXML,this,true,this.no_cashe);this.XMLLoader.waitCall=call||0;this.XMLLoader.loadXML(url);},
 _parseXML:function(that,a,b,c,obj){that.clearAll();var selected="";if (!obj)obj=that.XMLLoader;var atop=obj.getXMLTopNode("tabbar");var arows = obj.doXPath("//row",atop);var acs=atop.getAttribute("tabstyle");if (acs)that.setStyle(acs);that._hrfmode=atop.getAttribute("hrefmode")||that._hrfmode;that._a.margin =parseInt((atop.getAttribute("margin")||that._a.margin),10);acs=atop.getAttribute("align");if (acs)that._s.align = (acs=="right"||acs=="bottom");that._a.offset = parseInt((atop.getAttribute("offset")||that._a.offset),10);acs=atop.getAttribute("skinColors");if (acs)that.setSkinColors(acs.split(",")[0],acs.split(",")[1]);for (var i=0;i<arows.length;i++){var atabs = obj.doXPath("./tab",arows[i]);for (var j=0;j<atabs.length;j++){var width=atabs[j].getAttribute("width");var name=that._getXMLContent(atabs[j]);var id=atabs[j].getAttribute("id");that.addTab(id,name,width,"",i);if (atabs[j].getAttribute("selected")) selected=id;if (that._hrfmode)that.setContentHref(id,atabs[j].getAttribute("href"));else
 for (var k=0;k<atabs[j].childNodes.length;k++){var cont=atabs[j].childNodes[k];if (cont.tagName=="content"){if (cont.getAttribute("id"))
 that.setContent(id,cont.getAttribute("id"));else
 that.setContentHTML(id,that._getXMLContent(cont));}
 }
 }
 }
 if (selected)that.setTabActive(selected);that.callEvent("onXLE",[]);},
 adjustOuterSize:function(){this._setSizes();},
 _getXMLContent:function(node){var text="";for (var i=0;i<node.childNodes.length;i++){var z=node.childNodes[i];text+=(z.nodeValue===null?"":z.nodeValue);}
 return text;},

 
 enableContentZone:function(mode){this._conZone.style.display=((convertStringToBoolean(mode))?"":"none");this._setSizes();},

 enableForceHiding:function(mode){this._s.hide=convertStringToBoolean(mode);},


 
 setSize:function(x,y){this.entBox.style.width=x+"px";this.entBox.style.height=y+"px";this._setSizes();},

 
 setSkinColors:function(a,b,c){if (a)this._a.data_color=a;if (b)this._a.tab_color=b;this._conZone.style.backgroundColor=(c||a);},

 
 setCustomStyle:function(id,color,scolor,style){var str="";this._c[id]={color:(";"+(color?("color:"+color+";"):"")+(style||"")),
 scolor:(";"+(scolor?("color:"+scolor+";"):"")+(style||""))
 };if (this._tabs[id])this._tabs[id].childNodes[0].style.cssText=((this._tabs[id]==this._lastActive)?this._c[id].scolor:this._c[id].color);},

 
 setImagePath:function(url){this.imgUrl=url;},
 getNext:function(tab,alt){alt=alt||"nextSibling";var next=tab[alt];if (next && next.className.indexOf("dhx_tab_element")==-1) next=null;if (!next && tab.parentNode[alt])next=tab.parentNode[alt].childNodes[0];return next||tab;},

 getAllTabs:function(){var tabs = [];for(var id in this._tabs)tabs.push(id);return tabs;},

 
 goToNextTab:function(tab){do {tab=this.getNext(tab||this._lastActive)}while (!this._setTabActive(tab));return tab;},

 
 goToPrevTab:function(tab){do {tab=this.getNext((tab||this._lastActive),"previousSibling")}while (!this._setTabActive(tab));return tab;},

 
 disableTab:function(id){this._tabs[id]._disabled=true;this._tabs[id].style.color="silver";},

 
 enableTab:function(id){this._tabs[id]._disabled=false;this._tabs[id].style.color="";},

 
 showTab:function(id){var tab=this._tabs[id];tab.style.display="";this._setTabSizes(tab.parentNode);},

 
 hideTab:function(id, mode){var tab=this._tabs[id];tab.style.display="none";if (tab == this._lastActive && mode !== false)this.goToNextTab();this._setTabSizes(tab.parentNode);},

 
 getActiveTab:function(){if (!this._lastActive)return null;return this._lastActive.getAttribute("tab_id");},

 
 setLabel:function(id,text,size){var activeTab = this.getActiveTab();this._tabs[id].firstChild.innerHTML=text;this.adjustTabSize(this._tabs[id],size);this._setTabSizes(this._tabs[id].parentNode);this._checkScroll();},

 getLabel:function(id){return this._tabs[id].firstChild.innerHTML;}, 

 
 setOffset:function(n){this._a.offset=n*1;},

 enableScroll:function(mode){this._s.scrolls=convertStringToBoolean(mode);},

 
 setMargin:function(n){this._a.margin=n*1;},

 
 setAlign:function(n){this._s.align=(n=="bottom"||n=="right");},

 tabWindow:function(tab_id){return (this._content[tab_id]?this._content[tab_id]._frame.contentWindow:null);},
 
 setContentHTML:function(id,value){this.cells(id).attachHTMLString(value);},

 
 setContent:function(id,value){this.cells(id).attachObject(value);this.cells(id).activate();},

 
 setHrefMode:function(mode){this._hrfmode=mode;}, 

 
 setContentHref:function(id,href){this._hrefs[id]=href;switch (this._hrfmode){case "iframes":
 this.cells(id).attachURL(href);break;case "iframe":
 case "iframes-on-demand":
 this.cells(id)._delay=["url",href,false];break;case "ajax":
 var cell=this.cells(id);var that=this;cell._delay=["urlajax",href,true];if (!cell.attachHTMLStringA){cell.attachHTMLStringA=cell.attachHTMLString;cell.attachHTMLString=function(str,xml){if (xml)str=that._getXMLContent(xml.doXPath("//content")[0]);return this.attachHTMLStringA(str);}
 }
 
 break;case "ajax-html":
 this.cells(id)._delay=["urlajax",href,true];break;}
 if (this._tabs[id]==this._lastActive)this.cells(id).show(true);},



 normalize:function(limit,full){limit=limit||this._tabZone.offsetWidth;function correct_size(tab,i){tabs[i]._size=tabs[i]._size+(prev_size!=Infinity?(prev_size-size):0);tab.adjustTabSize(tabs[i],tabs[i]._size);}
 var tabs=[];for (var j=0;j<this._rows.length;j++)for (var i=0;i<this._rows[j].tabCount;i++)tabs.push(this._rows[j].removeChild(this._rows[j].childNodes[0]));this._tabZone.innerHTML="";this._rows=[];var t = this._lastActive;this._lastActive=null;this._createRow();var row=0;var size=this._a.offset;var prev_size=Infinity;var last_tab=null;var i=0;for (i;i<tabs.length;i++)if ((size + tabs[i]._size + this._a.margin)< limit){this._rows[row].appendChild(tabs[i]);this._rows[row].tabCount++;size+=tabs[i]._size + this._a.margin;}
 else {if (full && size<prev_size)correct_size(this,i-1);this._createRow();i--;row++;prev_size=size;size=this._a.offset;continue;}
 if (full && size<prev_size && prev_size!=Infinity)correct_size(this,i-1);for (var j=0;j < this._rows.length;j++)this._setTabSizes(this._rows[j]);this._setSizes();if (this._lastActive=t)this._setTabTop(this._lastActive);},

 showInnerScroll: function(){for (var i in this._tabs)if(this.cells(i).vs){var view = this.cells(i).av;this.cells(i).vs[view].dhxcont.mainCont[view].style.overflow="auto";}
 else
 this.cells(i).dhxcont.mainCont.style.overflow="auto";},
 
 
 getNumberOfTabs:function (){var tc = 0;for(var i=0;i<this._rows.length;i++)tc+=this._rows[i].tabCount;return tc;},
 
 destructor:function(){}
}
if (!window.dhtmlXContainer){window.dhtmlXContainer=function(obj) {var that = this;this.obj = obj;this.dhxcont = null;this.setContent = function(data) {this.dhxcont = data;this.dhxcont.innerHTML = "<div id='dhxMainCont' class='dhxcont_main_content'></div>"+
 "<div id='dhxContBlocker' class='dhxcont_content_blocker' style='display: none;'></div>";this.dhxcont.mainCont = this.dhxcont.childNodes[0];this.obj.dhxcont = this.dhxcont;}
 
 this.obj._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++){s = s + z.charAt(Math.round(Math.random() * z.length));}
 return s;}
 
 this.obj.setMinContentSize = function(w, h) {this._minDataSizeW = w;this._minDataSizeH = h;}
 
 this.obj.moveContentTo = function(cont) {cont.updateNestedObjects();}
 
 this.obj.adjustContent = function(parentObj, offsetTop, marginTop, notCalcWidth, offsetBottom) {this.dhxcont.style.top = offsetTop+"px";this.dhxcont.style.left = "0px";if (notCalcWidth == true){}else {this.dhxcont.style.width = parentObj.clientWidth+"px";}
 
 var px = parentObj.clientHeight-offsetTop;if (px < 0){px = 0;}
 
 this.dhxcont.style.height = px+(marginTop!=null?marginTop:0)+"px";if (notCalcWidth == true){}else {if (this.dhxcont.offsetWidth > parentObj.clientWidth){this.dhxcont.style.width = Math.max(0,parentObj.clientWidth*2-this.dhxcont.offsetWidth)+"px";}
 }
 if (this.dhxcont.offsetHeight > parentObj.clientHeight - offsetTop){var px = (parentObj.clientHeight-offsetTop)*2-this.dhxcont.offsetHeight;if (px < 0){px = 0;}
 
 this.dhxcont.style.height = px+"px";}
 if (offsetBottom){if (!isNaN(offsetBottom)) this.dhxcont.style.height = parseInt(this.dhxcont.style.height)-offsetBottom+"px";}
 
 
 
 
 
 if (this._minDataSizeH != null){if (parseInt(this.dhxcont.style.height)< this._minDataSizeH) {this.dhxcont.style.height = this._minDataSizeH+"px";}
 }
 if (this._minDataSizeW != null){if (parseInt(this.dhxcont.style.width)< this._minDataSizeW) {this.dhxcont.style.width = this._minDataSizeW+"px";}
 }
 
 if (notCalcWidth == true){}else {this.dhxcont.mainCont.style.width = this.dhxcont.clientWidth+"px";}
 
 var menuOffset = (this.menu!=null?(!this.menuHidden?this.menuHeight:0):0);var toolbarOffset = (this.toolbar!=null?(!this.toolbarHidden?this.toolbarHeight:0):0);var statusOffset = (this.sb!=null?(!this.sbHidden?this.sbHeight:0):0);this.dhxcont.mainCont.style.height = this.dhxcont.clientHeight-menuOffset-toolbarOffset-statusOffset+"px";}
 this.obj.updateNestedObjects = function() {}
 
 
 this.obj.attachObject = function(obj, autoSize) {if (typeof(obj)== "string") {obj = document.getElementById(obj);}
 if (autoSize){obj.style.visibility = "hidden";obj.style.display = "";var objW = obj.offsetWidth;var objH = obj.offsetHeight;}
 this._attachContent("obj", obj);if (autoSize && this._isWindow){obj.style.visibility = "";this._adjustToContent(objW, objH);}
 }
 
 this.obj.appendObject = function(obj) {if (typeof(obj)== "string") {obj = document.getElementById(obj);}
 this._attachContent("obj", obj, true);}
 
 this.obj.attachHTMLString = function(str) {this._attachContent("str", str);var z=str.match(/<script[^>]*>[^\f]*?<\/script>/g)||[];for (var i=0;i<z.length;i++){var s=z[i].replace(/<([\/]{0,1})script[^>]*>/g,"")
 if (window.execScript){var url = z[i].match(/<script[^>]*src\s*=\s*("|')([^"']+)("|')/);if (url)var s = dhtmlxAjax.getSync(url[2]).xmlDoc.responseText;if (s)window.execScript(s);}
 else window.eval(s);}
 }
 
 this.obj.attachURL = function(url, ajax) {this._attachContent((ajax==true?"urlajax":"url"), url, false);}
 
 this.obj._attachContent = function(type, obj, append) {if (append !== true){while (that.dhxcont.mainCont.childNodes.length > 0){that.dhxcont.mainCont.removeChild(that.dhxcont.mainCont.childNodes[0]);}
 }
 
 if (type == "url"){var fr = document.createElement("IFRAME");fr.frameBorder = 0;fr.border = 0;fr.style.width = "100%";fr.style.height = "100%";that.dhxcont.mainCont.appendChild(fr);fr.src = obj;this._frame = fr;if (this._doOnFrameContentLoaded)this._doOnFrameContentLoaded(true);}else if (type == "urlajax"){var t = this;var xmlParser=function(){t.attachHTMLString(this.xmlDoc.responseText,this);if (t._doOnFrameContentLoaded)t._doOnFrameContentLoaded(false);this.destructor();}
 var xmlLoader = new dtmlXMLLoaderObject(xmlParser, window);xmlLoader.loadXML(obj);if (t._doOnBeforeAttachURL)t._doOnBeforeAttachURL(false);}else if (type == "obj"){that.dhxcont._frame = null;that.dhxcont.mainCont.appendChild(obj);that.dhxcont.mainCont.style.overflow = (append===true?"auto":"hidden");obj.style.display = "";}else if (type == "str"){that.dhxcont._frame = null;that.dhxcont.mainCont.innerHTML = obj;}
 }
 
 this.obj._dhxContDestruct = function() {}
 
}
}
(function(){dhtmlx.extend_api("dhtmlXTabBar",{_init:function(obj){return [obj.parent,obj.mode,obj.height];},
 tabs:"tabs",
 skin:"setSkin",
 offset:"setOffset",
 margin:"setMargin",
 image_path:"setImagePath",
 href_mode:"setHrefMode",
 align:"setAlign",
 xml:"loadXML",
 close_button:"enableTabCloseButton",
 scroll:"enableScroll",
 forced:"enableForceHiding",
 content_zone:"enableContentZone",
 size_by_content:"enableAutoSize",
 auto_size:"enableAutoReSize"
 },{tabs:function(arr){for (var i=0;i<arr.length;i++){var t=arr[i];this.addTab(t.id,t.label, t.width, t.index, t.row);if (t.active)this.setTabActive(t.id);}
 }
 });})();function dhx_init_tabbars(){var z=document.getElementsByTagName("div");for (var i=0;i<z.length;i++)if(z[i].className.indexOf("dhtmlxTabBar")!=-1){var n=z[i];var id=n.id;n.className="";var k=new Array();for (var j=0;j<n.childNodes.length;j++)if (n.childNodes[j].tagName && n.childNodes[j].tagName!="!")k[k.length]=n.childNodes[j];var w=new dhtmlXTabBar(id,n.getAttribute("mode")||"top",n.getAttribute("tabheight")||20);window[id]=w;acs=n.getAttribute("onbeforeinit");if (acs)eval(acs);if (n.getAttribute("enableForceHiding")) w.enableForceHiding(true);w.setImagePath(n.getAttribute("imgpath"));var acs=n.getAttribute("margin");if (acs!=null)w._margin=acs;acs=n.getAttribute("align");if (acs)w._align=acs;acs=n.getAttribute("hrefmode");if (acs)w.setHrefMode(acs);acs=n.getAttribute("offset");if (acs!=null)w._offset=acs;acs=n.getAttribute("tabstyle");if (acs!=null)w.setStyle(acs);acs=n.getAttribute("select");var clrs=n.getAttribute("skinColors");if (clrs)w.setSkinColors(clrs.split(",")[0],clrs.split(",")[1]);for (var j=0;j<k.length;j++){var m=k[j];m.parentNode.removeChild(m)
 w.addTab(m.id,m.getAttribute("name"),m.getAttribute("width"),null,m.getAttribute("row"));var href=m.getAttribute("href");if (href)w.setContentHref(m.id,href);else w.setContent(m.id,m);if ((!w._dspN)&&(m.style.display=="none"))
 m.style.display="";}
 if (k.length)w.setTabActive(acs||k[0].id);acs=n.getAttribute("oninit");if (acs)eval(acs);}
 }
dhtmlxEvent(window,"load",dhx_init_tabbars);function dhtmlXToolbarObject(baseId, skin) {var main_self = this;this.cont = (typeof(baseId)!="object")?document.getElementById(baseId):baseId;while (this.cont.childNodes.length > 0)this.cont.removeChild(this.cont.childNodes[0]);this.cont.dir = "ltr";this.cont.innerHTML += "<div class='dhxtoolbar_hdrline_ll'></div><div class='dhxtoolbar_hdrline_rr'></div>"+
 "<div class='dhxtoolbar_hdrline_l'></div><div class='dhxtoolbar_hdrline_r'></div>";this.base = document.createElement("DIV");this.base.className = "float_left";this.cont.appendChild(this.base);this.align = "left";this.setAlign = function(align) {this.align = (align=="right"?"right":"left");this.base.className = (align=="right"?"float_right":"float_left");if (this._spacer)this._spacer.className = "dhxtoolbar_spacer "+(align=="right"?" float_left":" float_right");}
 
 this._isIE6 = false;if (_isIE)this._isIE6 = (window.XMLHttpRequest==null?true:false);this._isIPad = (navigator.userAgent.search(/iPad/gi)>=0);if (this._isIPad){this.cont.ontouchstart = function(e){e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 }
 
 this.iconSize = 18;this.setIconSize = function(size) {this.iconSize = ({18:true,24:true,32:true,48:true}[size]?size:18);this.setSkin(this.skin, true);this.callEvent("_onIconSizeChange",[this.iconSize]);}
 
 this.selectPolygonOffsetTop = 0;this.selectPolygonOffsetLeft = 0;this._improveTerraceSkin = function(id) {var k = null;if (id != null){k={};k[id]=id;}
 
 var bn = {buttonInput: true, separator: true, text: true};for (var a in (k||this.objPull)) {if (this.objPull[a] != null && this.objPull[a].obj != null){if (this.objPull[a].type == "buttonInput"){this.objPull[a].obj.className = this.objPull[a].obj.className.replace(/dhx_toolbar_btn/,"dhx_toolbar_inp");}
 
 
 var node = this.objPull[a][this.objPull[a].type=="buttonSelect"?"arw":"obj"];var br = false;var bl = false;if (!bn[this.objPull[a].type]){if (node == node.parentNode.lastChild){br = true;}
 
 if (node.nextSibling != null){var pType = null;for (var b in this.objPull){if (this.objPull[b].obj == node.nextSibling)pType = this.objPull[b].type;}
 if (bn[pType])br = true;}
 
 
 
 
 if (this.objPull[a].obj == node.parentNode.firstChild){bl = true;}
 
 if (this.objPull[a].obj.previousSibling != null){var pType = null;for (var b in this.objPull){if (this.objPull[b].obj == this.objPull[a].obj.previousSibling)pType = this.objPull[b].type;}
 if (bn[pType])bl = true;}
 
 }
 
 node.style.borderRight = (br?"1px solid #cecece":"");node.style.borderTopRightRadius = node.style.borderBottomRightRadius = (br?"5px":"0px");this.objPull[a].obj.style.borderTopLeftRadius = this.objPull[a].obj.style.borderBottomLeftRadius = (bl?"5px":"0px");this.objPull[a].obj._br = br;this.objPull[a].obj._bl = bl;node = null;}
 
 }
 }
 
 
 this._improveTerraceButtonSelect = function(id, state) {var item = this.objPull[id];if (state == true){item.obj.style.borderBottomLeftRadius = (item.obj._bl?"5px":"0px");item.arw.style.borderBottomRightRadius = (item.obj._br?"5px":"0px");}else {item.obj.style.borderBottomLeftRadius = "0px";item.arw.style.borderBottomRightRadius = "0px";}
 item = null;}
 
 this.setSkin = function(skin, onlyIcons) {if (onlyIcons === true){this.cont.className = this.cont.className.replace(/dhx_toolbar_base_\d{1,}_/,"dhx_toolbar_base_"+this.iconSize+"_");}else {this.skin = skin;if (this.skin == "dhx_skyblue"){this.selectPolygonOffsetTop = 1;}
 if (this.skin == "dhx_web"){this.selectPolygonOffsetTop = 1;this.selectPolygonOffsetLeft = 1;}
 if (this.skin == "dhx_terrace"){this.selectPolygonOffsetTop = -1;this.selectPolygonOffsetLeft = 0;}
 this.cont.className = "dhx_toolbar_base_"+this.iconSize+"_"+this.skin+(this.rtl?" rtl":"");}
 
 for (var a in this.objPull){var item = this.objPull[a];if (item["type"] == "slider"){item.pen._detectLimits();item.pen._definePos();item.label.className = "dhx_toolbar_slider_label_"+this.skin+(this.rtl?" rtl":"");}
 if (item["type"] == "buttonSelect"){item.polygon.className = "dhx_toolbar_poly_"+this.iconSize+"_"+this.skin+(this.rtl?" rtl":"");}
 }
 if (skin == "dhx_terrace")this._improveTerraceSkin();}
 this.setSkin(skin != null ? skin : (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : "dhx_skyblue"));this.objPull = {};this.anyUsed = "none";this.imagePath = "";this.setIconsPath = function(path) {this.imagePath = path;}
 
 this.setIconPath = this.setIconsPath;this._doOnLoad = function() {}
 
 this.loadXML = function(xmlFile, onLoadFunction) {if (onLoadFunction != null)this._doOnLoad = function() {onLoadFunction();}
 this.callEvent("onXLS", []);this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this._xmlLoader.loadXML(xmlFile);}
 
 this.loadXMLString = function(xmlString, onLoadFunction) {if (onLoadFunction != null){this._doOnLoad = function() {onLoadFunction();}}
 this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);this._xmlLoader.loadXMLString(xmlString);}
 this._xmlParser = function() {var root = this.getXMLTopNode("toolbar");var t = ["id", "type", "hidden", "title", "text", "enabled", "img", "imgdis", "action", "openAll", "renderSelect", "mode", "maxOpen", "width", "value", "selected", "length", "textMin", "textMax", "toolTip", "valueMin", "valueMax", "valueNow"];var p = ["id", "type", "enabled", "disabled", "action", "selected", "img", "text"];for (var q=0;q<root.childNodes.length;q++){if (root.childNodes[q].tagName == "item"){var itemData = {};for (var w=0;w<t.length;w++)itemData[t[w]] = root.childNodes[q].getAttribute(t[w]);itemData.items = [];itemData.userdata = [];for (var e=0;e<root.childNodes[q].childNodes.length;e++){if (root.childNodes[q].childNodes[e].tagName == "item" && itemData.type == "buttonSelect"){var u = {};for (var w=0;w<p.length;w++)u[p[w]] = root.childNodes[q].childNodes[e].getAttribute(p[w]);try {u.itemText = root.childNodes[q].childNodes[e].getElementsByTagName("itemText")[0].firstChild.nodeValue;}catch(k){};var h = root.childNodes[q].childNodes[e].getElementsByTagName("userdata");for (var w=0;w<h.length;w++){if (!u.userdata)u.userdata = {};var r = {};try {r.name = h[w].getAttribute("name");}catch(k) {r.name = "";}
 try {r.value = h[w].firstChild.nodeValue;}catch(k) {r.value = "";}
 if (r.name != "")u.userdata[r.name] = r.value;}
 
 itemData.items[itemData.items.length] = u;}
 
 if (root.childNodes[q].childNodes[e].tagName == "userdata"){var u = {};try {u.name = root.childNodes[q].childNodes[e].getAttribute("name");}catch(k) {u.name = "";}
 try {u.value = root.childNodes[q].childNodes[e].firstChild.nodeValue;}catch(k) {u.value = "";}
 itemData.userdata[itemData.userdata.length] = u;}
 }
 main_self._addItemToStorage(itemData);}
 }
 if (main_self.skin == "dhx_terrace")main_self._improveTerraceSkin();main_self.callEvent("onXLE", []);main_self._doOnLoad();this.destructor();}
 this._addItemToStorage = function(itemData, pos) {var id = (itemData.id||this._genStr(24));var type = (itemData.type||"");if (type != ""){if (this["_"+type+"Object"] != null){if ((typeof(itemData.openAll)== "undefined" || itemData.openAll == null) && this.skin == "dhx_terrace") itemData.openAll = true;this.objPull[this.idPrefix+id] = new this["_"+type+"Object"](this, id, itemData);this.objPull[this.idPrefix+id]["type"] = type;this.setPosition(id, pos);}
 }
 
 if (itemData.userdata){for (var q=0;q<itemData.userdata.length;q++)this.setUserData(id, itemData.userdata[q].name, itemData.userdata[q].value);}
 }
 
 this._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 this.rootTypes = new Array("button", "buttonSelect", "buttonTwoState", "separator", "label", "slider", "text", "buttonInput");this.idPrefix = this._genStr(12);dhtmlxEventable(this);this._getObj = function(obj, tag) {var targ = null;for (var q=0;q<obj.childNodes.length;q++){if (obj.childNodes[q].tagName != null){if (String(obj.childNodes[q].tagName).toLowerCase() == String(tag).toLowerCase()) targ = obj.childNodes[q];}
 }
 return targ;}
 
 this._addImgObj = function(obj) {var imgObj = document.createElement("IMG");if (obj.childNodes.length > 0)obj.insertBefore(imgObj, obj.childNodes[0]);else obj.appendChild(imgObj);return imgObj;}
 
 this._setItemImage = function(item, url, dis) {if (dis == true)item.imgEn = url;else item.imgDis = url;if ((!item.state && dis == true)|| (item.state && dis == false)) return;var imgObj = this._getObj(item.obj, "img");if (imgObj == null)imgObj = this._addImgObj(item.obj);imgObj.src = this.imagePath+url;}
 this._clearItemImage = function(item, dis) {if (dis == true)item.imgEn = "";else item.imgDis = "";if ((!item.state && dis == true)|| (item.state && dis == false)) return;var imgObj = this._getObj(item.obj, "img");if (imgObj != null)imgObj.parentNode.removeChild(imgObj);}
 
 this._setItemText = function(item, text) {var txtObj = this._getObj(item.obj, "div");if (text == null || text.length == 0){if (txtObj != null)txtObj.parentNode.removeChild(txtObj);return;}
 if (txtObj == null){txtObj = document.createElement("DIV");item.obj.appendChild(txtObj);}
 txtObj.innerHTML = text;}
 this._getItemText = function(item) {var txtObj = this._getObj(item.obj, "div");if (txtObj != null)return txtObj.innerHTML;return "";}
 
 
 this._enableItem = function(item) {if (item.state)return;item.state = true;if (this.objPull[item.id]["type"] == "buttonTwoState" && this.objPull[item.id]["obj"]["pressed"] == true){item.obj.className = "dhx_toolbar_btn pres";item.obj.renderAs = "dhx_toolbar_btn over";}else {item.obj.className = "dhx_toolbar_btn def";item.obj.renderAs = item.obj.className;}
 if (item.arw)item.arw.className = String(item.obj.className).replace("btn","arw");var imgObj = this._getObj(item.obj, "img");if (item.imgEn != ""){if (imgObj == null)imgObj = this._addImgObj(item.obj);imgObj.src = this.imagePath+item.imgEn;}else {if (imgObj != null)imgObj.parentNode.removeChild(imgObj);}
 }
 this._disableItem = function(item) {if (!item.state)return;item.state = false;item.obj.className = "dhx_toolbar_btn "+(this.objPull[item.id]["type"]=="buttonTwoState"&&item.obj.pressed?"pres_":"")+"dis";item.obj.renderAs = "dhx_toolbar_btn def";if (item.arw)item.arw.className = String(item.obj.className).replace("btn","arw");var imgObj = this._getObj(item.obj, "img");if (item.imgDis != ""){if (imgObj == null)imgObj = this._addImgObj(item.obj);imgObj.src = this.imagePath+item.imgDis;}else {if (imgObj != null)imgObj.parentNode.removeChild(imgObj);}
 
 
 if (item.polygon != null){if (item.polygon.style.display != "none"){item.polygon.style.display = "none";if (item.polygon._ie6cover)item.polygon._ie6cover.style.display = "none";if (this.skin == "dhx_terrace")this._improveTerraceButtonSelect(item.id, true);}
 }
 this.anyUsed = "none";}
 
 
 this.clearAll = function() {for (var a in this.objPull)this._removeItem(String(a).replace(this.idPrefix,""));}
 
 
 
 this._isWebToolbar = true;this._doOnClick = function(e) {main_self.forEachItem(function(itemId){if (main_self.objPull[main_self.idPrefix+itemId]["type"] == "buttonSelect"){var item = main_self.objPull[main_self.idPrefix+itemId];if (item.polygon.style.display != "none"){item.obj.renderAs = "dhx_toolbar_btn def";item.obj.className = item.obj.renderAs;item.arw.className = String(item.obj.renderAs).replace("btn","arw");main_self.anyUsed = "none";item.polygon.style.display = "none";if (item.polygon._ie6cover)item.polygon._ie6cover.style.display = "none";if (main_self.skin == "dhx_terrace")main_self._improveTerraceButtonSelect(item.id, true);}
 }
 });}
 if (this._isIPad){document.addEventListener("touchstart", this._doOnClick, false);}else {if (_isIE)document.body.attachEvent("onclick", this._doOnClick);else window.addEventListener("click", this._doOnClick, false);}
 
 
 return this;}
dhtmlXToolbarObject.prototype.addSpacer = function(nextToId) {var nti = this.idPrefix+nextToId;if (this._spacer != null){if (this._spacer.idd == nextToId)return;if (this._spacer == this.objPull[nti].obj.parentNode){var doMove = true;while (doMove){var idd = this._spacer.childNodes[0].idd;this.base.appendChild(this._spacer.childNodes[0]);if (idd == nextToId || this._spacer.childNodes.length == 0){if (this.objPull[nti].arw != null)this.base.appendChild(this.objPull[nti].arw);doMove = false;}
 }
 this._spacer.idd = nextToId;this._fixSpacer();return;}
 
 if (this.base == this.objPull[nti].obj.parentNode){var doMove = true;var chArw = (this.objPull[nti].arw!=null);while (doMove){var q = this.base.childNodes.length-1;if (chArw == true)if (this.base.childNodes[q] == this.objPull[nti].arw)doMove = false;if (this.base.childNodes[q].idd == nextToId)doMove = false;if (doMove){if (this._spacer.childNodes.length > 0)this._spacer.insertBefore(this.base.childNodes[q], this._spacer.childNodes[0]);else this._spacer.appendChild(this.base.childNodes[q]);}
 }
 this._spacer.idd = nextToId;this._fixSpacer();return;}
 
 }else {var np = null;for (var q=0;q<this.base.childNodes.length;q++){if (this.base.childNodes[q] == this.objPull[this.idPrefix+nextToId].obj){np = q;if (this.objPull[this.idPrefix+nextToId].arw != null)np = q+1;}
 }
 if (np != null){this._spacer = document.createElement("DIV");this._spacer.className = "dhxtoolbar_spacer "+(this.align=="right"?" float_left":" float_right");this._spacer.dir = "rtl";this._spacer.idd = nextToId;while (this.base.childNodes.length > np+1)this._spacer.appendChild(this.base.childNodes[np+1]);this.cont.appendChild(this._spacer);this._fixSpacer();}
 }
 if (this.skin == "dhx_terrace")this._improveTerraceSkin();}
dhtmlXToolbarObject.prototype.removeSpacer = function() {if (!this._spacer)return;while (this._spacer.childNodes.length > 0)this.base.appendChild(this._spacer.childNodes[0]);this._spacer.parentNode.removeChild(this._spacer);this._spacer = null;if (this.skin == "dhx_terrace")this._improveTerraceSkin();}
dhtmlXToolbarObject.prototype._fixSpacer = function() {if (_isIE && this._spacer != null){this._spacer.style.borderLeft = "1px solid #a4bed4";var k = this._spacer;window.setTimeout(function(){k.style.borderLeft="0px solid #a4bed4";k=null;},1);}
}
dhtmlXToolbarObject.prototype.getType = function(itemId) {var parentId = this.getParentId(itemId);if (parentId != null){var typeExt = null;var itemData = this.objPull[this.idPrefix+parentId]._listOptions[itemId];if (itemData != null)if (itemData.sep != null)typeExt = "buttonSelectSeparator";else typeExt = "buttonSelectButton";return typeExt;}else {if (this.objPull[this.idPrefix+itemId] == null)return null;return this.objPull[this.idPrefix+itemId]["type"];}
}
dhtmlXToolbarObject.prototype.getTypeExt = function(itemId) {var type = this.getType(itemId);if (type == "buttonSelectButton" || type == "buttonSelectSeparator"){if (type == "buttonSelectButton")type = "button";else type = "separator";return type;}
 return null;}
dhtmlXToolbarObject.prototype.inArray = function(array, value) {for (var q=0;q<array.length;q++){if (array[q]==value)return true;}
 return false;}
dhtmlXToolbarObject.prototype.getParentId = function(listId) {var parentId = null;for (var a in this.objPull)if (this.objPull[a]._listOptions)for (var b in this.objPull[a]._listOptions)if (b == listId)parentId = String(a).replace(this.idPrefix,"");return parentId;}
dhtmlXToolbarObject.prototype._addItem = function(itemData, pos) {this._addItemToStorage(itemData, pos);if (this.skin == "dhx_terrace")this._improveTerraceSkin();}
dhtmlXToolbarObject.prototype.addButton = function(id, pos, text, imgEnabled, imgDisabled) {this._addItem({id:id, type:"button", text:text, img:imgEnabled, imgdis:imgDisabled}, pos);}
dhtmlXToolbarObject.prototype.addText = function(id, pos, text) {this._addItem({id:id,type:"text",text:text}, pos);}
dhtmlXToolbarObject.prototype.addButtonSelect = function(id, pos, text, opts, imgEnabled, imgDisabled, renderSelect, openAll, maxOpen) {var items = [];for (var q=0;q<opts.length;q++){var u = {};if (opts[q].id && opts[q].type){u.id = opts[q].id;u.type = (opts[q].type=="obj"?"button":"separator");u.text = opts[q].text;u.img = opts[q].img;}else {u.id = opts[q][0];u.type = (opts[q][1]=="obj"?"button":"separator");u.text = (opts[q][2]||null);u.img = (opts[q][3]||null);}
 items[items.length] = u;}
 this._addItem({id:id, type:"buttonSelect", text:text, img:imgEnabled, imgdis:imgDisabled, renderSelect:renderSelect, openAll:openAll, items:items, maxOpen:maxOpen}, pos);}
dhtmlXToolbarObject.prototype.addButtonTwoState = function(id, pos, text, imgEnabled, imgDisabled) {this._addItem({id:id, type:"buttonTwoState", img:imgEnabled, imgdis:imgDisabled, text:text}, pos);}
dhtmlXToolbarObject.prototype.addSeparator = function(id, pos) {this._addItem({id:id,type:"separator"}, pos);}
dhtmlXToolbarObject.prototype.addSlider = function(id, pos, len, valueMin, valueMax, valueNow, textMin, textMax, tip) {this._addItem({id:id, type:"slider", length:len, valueMin:valueMin, valueMax:valueMax, valueNow:valueNow, textMin:textMin, textMax:textMax, toolTip:tip}, pos);}
dhtmlXToolbarObject.prototype.addInput = function(id, pos, value, width) {this._addItem({id:id,type:"buttonInput",value:value,width:width}, pos);}
dhtmlXToolbarObject.prototype.forEachItem = function(handler) {for (var a in this.objPull){if (this.inArray(this.rootTypes, this.objPull[a]["type"])) {handler(this.objPull[a]["id"].replace(this.idPrefix,""));}
 }
};(function(){var list="showItem,hideItem,isVisible,enableItem,disableItem,isEnabled,setItemText,getItemText,setItemToolTip,getItemToolTip,getInput,setItemImage,setItemImageDis,clearItemImage,clearItemImageDis,setItemState,getItemState,setItemToolTipTemplate,getItemToolTipTemplate,setValue,getValue,setMinValue,getMinValue,setMaxValue,getMaxValue,setWidth,getWidth,setMaxOpen".split(",")
 var ret=["","",false,"","",false,"","","","","","","","","",false,"","","",null,"",[null,null],"",[null,null],"",null]
 var functor=function(name,res){return function(itemId,a,b){itemId = this.idPrefix+itemId;if (this.objPull[itemId][name] != null)return this.objPull[itemId][name].call(this.objPull[itemId],a,b)
 else 
 return res;};}
 
 for (var i=0;i<list.length;i++){var name=list[i];var res=ret[i];dhtmlXToolbarObject.prototype[name] = functor(name,res);}
})()























































dhtmlXToolbarObject.prototype.getPosition = function(itemId) {return this._getPosition(itemId);}
dhtmlXToolbarObject.prototype._getPosition = function(id, getRealPosition) {if (this.objPull[this.idPrefix+id] == null)return null;var pos = null;var w = 0;for (var q=0;q<this.base.childNodes.length;q++){if (this.base.childNodes[q].idd != null){if (this.base.childNodes[q].idd == id)pos = w;w++;}
 }
 if (!pos && this._spacer != null){for (var q=0;q<this._spacer.childNodes.length;q++){if (this._spacer.childNodes[q].idd != null){if (this._spacer.childNodes[q].idd == id)pos = w;w++;}
 }
 }
 return pos;}
dhtmlXToolbarObject.prototype.setPosition = function(itemId, pos) {this._setPosition(itemId, pos);}
dhtmlXToolbarObject.prototype._setPosition = function(id, pos) {if (this.objPull[this.idPrefix+id] == null)return;if (isNaN(pos)) pos = this.base.childNodes.length;if (pos < 0)pos = 0;var spacerId = null;if (this._spacer){spacerId = this._spacer.idd;this.removeSpacer();}
 
 var item = this.objPull[this.idPrefix+id];this.base.removeChild(item.obj);if (item.arw)this.base.removeChild(item.arw);var newPos = this._getIdByPosition(pos, true);if (newPos[0] == null){this.base.appendChild(item.obj);if (item.arw)this.base.appendChild(item.arw);}else {this.base.insertBefore(item.obj, this.base.childNodes[newPos[1]]);if (item.arw)this.base.insertBefore(item.arw, this.base.childNodes[newPos[1]+1]);}
 if (spacerId != null)this.addSpacer(spacerId);}
dhtmlXToolbarObject.prototype._getIdByPosition = function(pos, retRealPos) {var id = null;var w = 0;var realPos = 0;for (var q=0;q<this.base.childNodes.length;q++){if (this.base.childNodes[q]["idd"] != null && id == null){if ((w++)== pos) id = this.base.childNodes[q]["idd"];}
 if (id == null)realPos++;}
 realPos = (id==null?null:realPos);return (retRealPos==true?new Array(id, realPos):id);}
dhtmlXToolbarObject.prototype.removeItem = function(itemId) {this._removeItem(itemId);if (this.skin == "dhx_terrace")this._improveTerraceSkin();};dhtmlXToolbarObject.prototype._removeItem = function(itemId) {var t = this.getType(itemId);itemId = this.idPrefix+itemId;var p = this.objPull[itemId];if (t == "button"){p.obj._doOnMouseOver = null;p.obj._doOnMouseOut = null;p.obj._doOnMouseUp = null;p.obj._doOnMouseUpOnceAnywhere = null;p.obj.onclick = null;p.obj.onmouseover = null;p.obj.onmouseout = null;p.obj.onmouseup = null;p.obj.onmousedown = null;p.obj.onselectstart = null;p.obj.renderAs = null;p.obj.idd = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.state = null;p.img = null;p.imgEn = null;p.imgDis = null;p.type = null;p.enableItem = null;p.disableItem = null;p.isEnabled = null;p.showItem = null;p.hideItem = null;p.isVisible = null;p.setItemText = null;p.getItemText = null;p.setItemImage = null;p.clearItemImage = null;p.setItemImageDis = null;p.clearItemImageDis = null;p.setItemToolTip = null;p.getItemToolTip = null;}
 
 if (t == "buttonTwoState"){p.obj._doOnMouseOver = null;p.obj._doOnMouseOut = null;p.obj.onmouseover = null;p.obj.onmouseout = null;p.obj.onmousedown = null;p.obj.onselectstart = null;p.obj.renderAs = null;p.obj.idd = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.state = null;p.img = null;p.imgEn = null;p.imgDis = null;p.type = null;p.enableItem = null;p.disableItem = null;p.isEnabled = null;p.showItem = null;p.hideItem = null;p.isVisible = null;p.setItemText = null;p.getItemText = null;p.setItemImage = null;p.clearItemImage = null;p.setItemImageDis = null;p.clearItemImageDis = null;p.setItemToolTip = null;p.getItemToolTip = null;p.setItemState = null;p.getItemState = null;}
 
 if (t == "buttonSelect"){for (var a in p._listOptions)this.removeListOption(itemId, a);p._listOptions = null;if (p.polygon._ie6cover){document.body.removeChild(p.polygon._ie6cover);p.polygon._ie6cover = null;}
 
 p.p_tbl.removeChild(p.p_tbody);p.polygon.removeChild(p.p_tbl);p.polygon.onselectstart = null;document.body.removeChild(p.polygon);p.p_tbody = null;p.p_tbl = null;p.polygon = null;p.obj.onclick = null;p.obj.onmouseover = null;p.obj.onmouseout = null;p.obj.onmouseup = null;p.obj.onmousedown = null;p.obj.onselectstart = null;p.obj.idd = null;p.obj.iddPrefix = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.arw.onclick = null;p.arw.onmouseover = null;p.arw.onmouseout = null;p.arw.onmouseup = null;p.arw.onmousedown = null;p.arw.onselectstart = null;p.arw.parentNode.removeChild(p.arw);p.arw = null;p.renderSelect = null;p.state = null;p.type = null;p.id = null;p.img = null;p.imgEn = null;p.imgDis = null;p.openAll = null;p._isListButton = null;p._separatorButtonSelectObject = null;p._buttonButtonSelectObject = null;p.setWidth = null;p.enableItem = null;p.disableItem = null;p.isEnabled = null;p.showItem = null;p.hideItem = null;p.isVisible = null;p.setItemText = null;p.getItemText = null;p.setItemImage = null;p.clearItemImage = null;p.setItemImageDis = null;p.clearItemImageDis = null;p.setItemToolTip = null;p.getItemToolTip = null;p.addListOption = null;p.removeListOption = null;p.showListOption = null;p.hideListOption = null;p.isListOptionVisible = null;p.enableListOption = null;p.disableListOption = null;p.isListOptionEnabled = null;p.setListOptionPosition = null;p.getListOptionPosition = null;p.setListOptionImage = null;p.getListOptionImage = null;p.clearListOptionImage = null;p.setListOptionText = null;p.getListOptionText = null;p.setListOptionToolTip = null;p.getListOptionToolTip = null;p.forEachListOption = null;p.getAllListOptions = null;p.setListOptionSelected = null;p.getListOptionSelected = null;}
 
 if (t == "buttonInput"){p.obj.childNodes[0].onkeydown = null;p.obj.removeChild(p.obj.childNodes[0]);p.obj.w = null;p.obj.idd = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.type = null;p.enableItem = null;p.disableItem = null;p.isEnabled = null;p.showItem = null;p.hideItem = null;p.isVisible = null;p.setItemToolTip = null;p.getItemToolTip = null;p.setWidth = null;p.getWidth = null;p.setValue = null;p.getValue = null;p.setItemText = null;p.getItemText = null;}
 
 if (t == "slider"){if (this._isIPad){document.removeEventListener("touchmove", pen._doOnMouseMoveStart, false);document.removeEventListener("touchend", pen._doOnMouseMoveEnd, false);}else {if (_isIE){document.body.detachEvent("onmousemove", p.pen._doOnMouseMoveStart);document.body.detachEvent("onmouseup", p.pen._doOnMouseMoveEnd);}else {window.removeEventListener("mousemove", p.pen._doOnMouseMoveStart, false);window.removeEventListener("mouseup", p.pen._doOnMouseMoveEnd, false);}
 }
 
 p.pen.allowMove = null;p.pen.initXY = null;p.pen.maxX = null;p.pen.minX = null;p.pen.nowX = null;p.pen.newNowX = null;p.pen.valueMax = null;p.pen.valueMin = null;p.pen.valueNow = null;p.pen._definePos = null;p.pen._detectLimits = null;p.pen._doOnMouseMoveStart = null;p.pen._doOnMouseMoveEnd = null;p.pen.onmousedown = null;p.obj.removeChild(p.pen);p.pen = null;p.label.tip = null;document.body.removeChild(p.label);p.label = null;p.obj.onselectstart = null;p.obj.idd = null;while (p.obj.childNodes.length > 0)p.obj.removeChild(p.obj.childNodes[0]);p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.type = null;p.state = null;p.enableItem = null;p.disableItem = null;p.isEnabled = null;p.setItemToolTipTemplate = null;p.getItemToolTipTemplate = null;p.setMaxValue = null;p.setMinValue = null;p.getMaxValue = null;p.getMinValue = null;p.setValue = null;p.getValue = null;p.showItem = null;p.hideItem = null;p.isVisible = null;}
 
 if (t == "separator"){p.obj.onselectstart = null;p.obj.idd = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.type = null;p.showItem = null;p.hideItem = null;p.isVisible = null;}
 
 if (t == "text"){p.obj.onselectstart = null;p.obj.idd = null;p.obj.parentNode.removeChild(p.obj);p.obj = null;p.id = null;p.type = null;p.showItem = null;p.hideItem = null;p.isVisible = null;p.setWidth = null;p.setItemText = null;p.getItemText = null;}
 
 t = null;p = null;this.objPull[this.idPrefix+itemId] = null;delete this.objPull[this.idPrefix+itemId];};(function(){var list="addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(",")
 var functor = function(name){return function(parentId,a,b,c,d,e){parentId = this.idPrefix+parentId;if (this.objPull[parentId] == null)return;if (this.objPull[parentId]["type"] != "buttonSelect")return;return this.objPull[parentId][name].call(this.objPull[parentId],a,b,c,d,e);}
 }
 for (var i=0;i<list.length;i++){var name=list[i];dhtmlXToolbarObject.prototype[name]=functor(name)
 }
})()











































dhtmlXToolbarObject.prototype._rtlParseBtn = function(t1, t2) {return t1+t2;}
dhtmlXToolbarObject.prototype._separatorObject = function(that, id, data) {this.id = that.idPrefix+id;this.obj = document.createElement("DIV");this.obj.className = "dhx_toolbar_sep";this.obj.style.display = (data.hidden!=null?"none":"");this.obj.idd = String(id);this.obj.title = (data.title||"");this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 if (that._isIPad){this.obj.ontouchstart = function(e){e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 }
 
 
 that.base.appendChild(this.obj);this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 
 return this;}
dhtmlXToolbarObject.prototype._textObject = function(that, id, data) {this.id = that.idPrefix+id;this.obj = document.createElement("DIV");this.obj.className = "dhx_toolbar_text";this.obj.style.display = (data.hidden!=null?"none":"");this.obj.idd = String(id);this.obj.title = (data.title||"");this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 if (that._isIPad){this.obj.ontouchstart = function(e){e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 }
 
 this.obj.innerHTML = (data.text||"");that.base.appendChild(this.obj);this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 this.setItemText = function(text) {this.obj.innerHTML = text;}
 this.getItemText = function() {return this.obj.innerHTML;}
 this.setWidth = function(width) {this.obj.style.width = width+"px";}
 this.setItemToolTip = function(t) {this.obj.title = t;}
 this.getItemToolTip = function() {return this.obj.title;}
 
 return this;}
dhtmlXToolbarObject.prototype._buttonObject = function(that, id, data) {this.id = that.idPrefix+id;this.state = (data.enabled!=null?false:true);this.imgEn = (data.img||"");this.imgDis = (data.imgdis||"");this.img = (this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.obj = document.createElement("DIV");this.obj.className = "dhx_toolbar_btn "+(this.state?"def":"dis");this.obj.style.display = (data.hidden!=null?"none":"");this.obj.allowClick = false;this.obj.extAction = (data.action||null);this.obj.renderAs = this.obj.className;this.obj.idd = String(id);this.obj.title = (data.title||"");this.obj.pressed = false;this.obj.innerHTML = that._rtlParseBtn((this.img!=""?"<img src='"+that.imagePath+this.img+"'>":""), (data.text!=null?"<div>"+data.text+"</div>":""));var obj = this;this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.obj.onmouseover = function() {this._doOnMouseOver();}
 this.obj.onmouseout = function() {this._doOnMouseOut();}
 this.obj._doOnMouseOver = function() {this.allowClick = true;if (obj.state == false)return;if (that.anyUsed != "none")return;this.className = "dhx_toolbar_btn over";this.renderAs = this.className;}
 this.obj._doOnMouseOut = function() {this.allowClick = false;if (obj.state == false)return;if (that.anyUsed != "none")return;this.className = "dhx_toolbar_btn def";this.renderAs = this.renderAs;}
 
 this.obj.onclick = function(e) {if (obj.state == false)return;if (this.allowClick == false)return;e = e||event;var id = this.idd.replace(that.idPrefix,"");if (this.extAction)try {window[this.extAction](id);}catch(e){};if(that&&that.callEvent)that.callEvent("onClick", [id]);}
 
 this.obj[that._isIPad?"ontouchstart":"onmousedown"] = function(e) {if (obj.state == false){e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 if (that.anyUsed != "none")return;that.anyUsed = this.idd;this.className = "dhx_toolbar_btn pres";this.pressed = true;this.onmouseover = function() {this._doOnMouseOver();}
 this.onmouseout = function() {that.anyUsed = "none";this._doOnMouseOut();}
 return false;}
 this.obj[that._isIPad?"ontouchend":"onmouseup"] = function(e) {if (obj.state == false)return;if (that.anyUsed != "none"){if (that.anyUsed != this.idd)return;}
 var t = that.anyUsed;this._doOnMouseUp();if (that._isIPad && t != "none")that.callEvent("onClick", [this.idd.replace(that.idPrefix,"")]);}
 if (that._isIPad){this.obj.ontouchmove = function(e) {this._doOnMouseUp();}
 }
 this.obj._doOnMouseUp = function() {that.anyUsed = "none";this.className = this.renderAs;this.pressed = false;}
 this.obj._doOnMouseUpOnceAnywhere = function() {this._doOnMouseUp();this.onmouseover = function() {this._doOnMouseOver();}
 this.onmouseout = function() {this._doOnMouseOut();}
 }
 
 
 that.base.appendChild(this.obj);this.enableItem = function() {that._enableItem(this);}
 this.disableItem = function() {that._disableItem(this);}
 this.isEnabled = function() {return this.state;}
 this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 this.setItemText = function(text) {that._setItemText(this, text);}
 this.getItemText = function() {return that._getItemText(this);}
 this.setItemImage = function(url) {that._setItemImage(this, url, true);}
 this.clearItemImage = function() {that._clearItemImage(this, true);}
 this.setItemImageDis = function(url) {that._setItemImage(this, url, false);}
 this.clearItemImageDis = function() {that._clearItemImage(this, false);}
 this.setItemToolTip = function(tip) {this.obj.title = tip;}
 this.getItemToolTip = function() {return this.obj.title;}
 return this;}
dhtmlXToolbarObject.prototype._buttonSelectObject = function(that, id, data) {this.id = that.idPrefix+id;this.state = (data.enabled!=null?(data.enabled=="true"?true:false):true);this.imgEn = (data.img||"");this.imgDis = (data.imgdis||"");this.img = (this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.mode = (data.mode||"button");if (this.mode == "select"){this.openAll = true;this.renderSelect = false;if (!data.text||data.text.length==0)data.text = "&nbsp;"
 }else {this.openAll = (data.openAll=="true"||data.openAll==true||data.openAll==1||data.openAll=="1"||data.openAll=="yes"||data.openAll=="on");this.renderSelect = (data.renderSelect!=null?(data.renderSelect=="false"||data.renderSelect=="disabled"?false:true):true);}
 this.maxOpen = (!isNaN(data.maxOpen?data.maxOpen:"")?data.maxOpen:null);this._maxOpenTest = function() {if (!isNaN(this.maxOpen)) {if (!that._sbw){var t = document.createElement("DIV");t.className = "dhxtoolbar_maxopen_test";document.body.appendChild(t);var k = document.createElement("DIV");k.className = "dhxtoolbar_maxopen_test2";t.appendChild(k);that._sbw = t.offsetWidth-k.offsetWidth;t.removeChild(k);k = null;document.body.removeChild(t);t = null;}
 }
 }
 this._maxOpenTest();this.obj = document.createElement("DIV");this.obj.allowClick = false;this.obj.extAction = (data.action||null);this.obj.className = "dhx_toolbar_btn "+(this.state?"def":"dis");this.obj.style.display = (data.hidden!=null?"none":"");this.obj.renderAs = this.obj.className;this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.obj.idd = String(id);this.obj.title = (data.title||"");this.obj.pressed = false;this.callEvent = false;this.obj.innerHTML = that._rtlParseBtn((this.img!=""?"<img src='"+that.imagePath+this.img+"'>":""),(data.text!=null?"<div>"+data.text+"</div>":""));that.base.appendChild(this.obj);this.arw = document.createElement("DIV");this.arw.className = "dhx_toolbar_arw "+(this.state?"def":"dis");;this.arw.style.display = this.obj.style.display;this.arw.innerHTML = "<div class='arwimg'>&nbsp;</div>";this.arw.title = this.obj.title;this.arw.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 that.base.appendChild(this.arw);var self = this;this.obj.onmouseover = function(e) {e = e||event;if (that.anyUsed != "none")return;if (!self.state)return;self.obj.renderAs = "dhx_toolbar_btn over";self.obj.className = self.obj.renderAs;self.arw.className = String(self.obj.renderAs).replace("btn","arw");}
 this.obj.onmouseout = function() {self.obj.allowClick = false;if (that.anyUsed != "none")return;if (!self.state)return;self.obj.renderAs = "dhx_toolbar_btn def";self.obj.className = self.obj.renderAs;self.arw.className = String(self.obj.renderAs).replace("btn","arw");self.callEvent = false;}
 this.arw.onmouseover = this.obj.onmouseover;this.arw.onmouseout = this.obj.onmouseout;if (this.openAll == true){}else {this.obj.onclick = function(e) {e = e||event;if (!self.obj.allowClick)return;if (!self.state)return;if (that.anyUsed != "none")return;var id = self.obj.idd.replace(that.idPrefix,"");if (self.obj.extAction)try {window[self.obj.extAction](id);}catch(e){};that.callEvent("onClick", [id]);}
 this.obj[that._isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (that.anyUsed != "none")return;if (!self.state)return;self.obj.allowClick = true;self.obj.className = "dhx_toolbar_btn pres";self.arw.className = "dhx_toolbar_arw pres";self.callEvent = true;}
 this.obj[that._isIPad?"ontouchend":"onmouseup"] = function(e) {e = e||event;e.cancelBubble = true;if (that.anyUsed != "none")return;if (!self.state)return;self.obj.className = self.obj.renderAs;self.arw.className = String(self.obj.renderAs).replace("btn","arw");if (that._isIPad && self.callEvent){var id = self.obj.idd.replace(that.idPrefix,"");that.callEvent("onClick", [id]);}
 }
 
 }
 
 if (that._isIPad){this.obj.ontouchmove = this.obj.onmouseout;}
 
 this.arw[that._isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;if (!self.state)return;if (that.anyUsed == self.obj.idd){self.obj.className = self.obj.renderAs;self.arw.className = String(self.obj.renderAs).replace("btn","arw");that.anyUsed = "none";self.polygon.style.display = "none";if (self.polygon._ie6cover)self.polygon._ie6cover.style.display = "none";if (that.skin == "dhx_terrace")that._improveTerraceButtonSelect(self.id, true);}else {if (that.anyUsed != "none"){if (that.objPull[that.idPrefix+that.anyUsed]["type"] == "buttonSelect"){var item = that.objPull[that.idPrefix+that.anyUsed];if (item.polygon.style.display != "none"){item.obj.renderAs = "dhx_toolbar_btn def";item.obj.className = item.obj.renderAs;item.arw.className = String(self.obj.renderAs).replace("btn","arw");item.polygon.style.display = "none";if (item.polygon._ie6cover)item.polygon._ie6cover.style.display = "none";if (that.skin == "dhx_terrace")that._improveTerraceButtonSelect(item.id, true);}
 }
 }
 self.obj.className = "dhx_toolbar_btn over";self.arw.className = "dhx_toolbar_arw pres";that.anyUsed = self.obj.idd;self.polygon.style.top = "0px";self.polygon.style.visibility = "hidden";self.polygon.style.display = "";if (that.skin == "dhx_terrace")that._improveTerraceButtonSelect(self.id, false);self._fixMaxOpenHeight(self.maxOpen||null);that._autoDetectVisibleArea();var newTop = getAbsoluteTop(self.obj)+self.obj.offsetHeight+that.selectPolygonOffsetTop;var newH = self.polygon.offsetHeight;if (newTop + newH > that.tY2){var k0 = (self.maxOpen!=null?Math.floor((that.tY2-newTop)/22):0);if (k0 >= 1){self._fixMaxOpenHeight(k0);}else {newTop = getAbsoluteTop(self.obj)-newH-that.selectPolygonOffsetTop;if (newTop < 0)newTop = 0;}
 }
 self.polygon.style.top = newTop+"px";if (that.rtl){self.polygon.style.left = getAbsoluteLeft(self.obj)+self.obj.offsetWidth-self.polygon.offsetWidth+that.selectPolygonOffsetLeft+"px";}else {self.polygon.style.left = getAbsoluteLeft(self.obj)+that.selectPolygonOffsetLeft+"px";}
 self.polygon.style.visibility = "visible";if (self.polygon._ie6cover){self.polygon._ie6cover.style.left = self.polygon.style.left;self.polygon._ie6cover.style.top = self.polygon.style.top;self.polygon._ie6cover.style.width = self.polygon.offsetWidth+"px";self.polygon._ie6cover.style.height = self.polygon.offsetHeight+"px";self.polygon._ie6cover.style.display = "";}
 }
 return false;}
 this.arw.onclick = function(e) {e = e||event;e.cancelBubble = true;}
 this.arw[that._isIPad?"ontouchend":"onmouseup"] = function(e) {e = e||event;e.cancelBubble = true;}
 
 
 if (this.openAll === true){this.obj.onclick = this.arw.onclick;this.obj.onmousedown = this.arw.onmousedown;this.obj.onmouseup = this.arw.onmouseup;if (that._isIPad){this.obj.ontouchstart = this.arw.ontouchstart;this.obj.ontouchend = this.arw.ontouchend;}
 }
 
 this.obj.iddPrefix = that.idPrefix;this._listOptions = {};this._fixMaxOpenHeight = function(maxOpen) {var h = "auto";var h0 = false;if (maxOpen !== null){var t = 0;for (var a in this._listOptions)t++;if (t > maxOpen){this._ph = 22*maxOpen;h = this._ph+"px";}else {h0 = true;}
 }
 this.polygon.style.width = "auto";this.polygon.style.height = "auto";if (!h0 && self.maxOpen != null){this.polygon.style.width = this.p_tbl.offsetWidth+that._sbw+"px";this.polygon.style.height = h;}
 }
 
 
 this._separatorButtonSelectObject = function(id, data, pos) {this.obj = {};this.obj.tr = document.createElement("TR");this.obj.tr.className = "tr_sep";this.obj.tr.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 this.obj.td = document.createElement("TD");this.obj.td.colSpan = "2";this.obj.td.className = "td_btn_sep";this.obj.td.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 
 if (isNaN(pos)) pos = self.p_tbody.childNodes.length+1;else if (pos < 1)pos = 1;if (pos > self.p_tbody.childNodes.length)self.p_tbody.appendChild(this.obj.tr);else self.p_tbody.insertBefore(this.obj.tr, self.p_tbody.childNodes[pos-1]);this.obj.tr.appendChild(this.obj.td);this.obj.sep = document.createElement("DIV");this.obj.sep.className = "btn_sep";this.obj.sep.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 this.obj.td.appendChild(this.obj.sep);self._listOptions[id] = this.obj;return this;}
 
 this._buttonButtonSelectObject = function(id, data, pos) {this.obj = {};this.obj.tr = document.createElement("TR");this.obj.tr.en = (data.enabled=="false"?false:(data.disabled=="true"?false:true));this.obj.tr.extAction = (data.action||null);this.obj.tr._selected = (data.selected!=null);this.obj.tr.className = "tr_btn"+(this.obj.tr.en?(this.obj.tr._selected&&self.renderSelect?" tr_btn_selected":""):" tr_btn_disabled");this.obj.tr.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 this.obj.tr.idd = String(id);if (data.userdata)this.obj.userData = data.userdata;if (isNaN(pos)) pos = self.p_tbody.childNodes.length+1;else if (pos < 1)pos = 1;if (pos > self.p_tbody.childNodes.length)self.p_tbody.appendChild(this.obj.tr);else self.p_tbody.insertBefore(this.obj.tr, self.p_tbody.childNodes[pos-1]);this.obj.td_a = document.createElement("TD");this.obj.td_a.className = "td_btn_img";this.obj.td_a.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 this.obj.td_b = document.createElement("TD");this.obj.td_b.className = "td_btn_txt";this.obj.td_b.onselectstart = function(e) {e = e||event;e.returnValue = false;return false;}
 
 if (that.rtl){this.obj.tr.appendChild(this.obj.td_b);this.obj.tr.appendChild(this.obj.td_a);}else {this.obj.tr.appendChild(this.obj.td_a);this.obj.tr.appendChild(this.obj.td_b);}
 
 
 if (data.img != null){this.obj.td_a.innerHTML = "<img class='btn_sel_img' src='"+that.imagePath+data.img+"' border='0'>";this.obj.tr._img = data.img;}
 
 
 var itemText = (data.text!=null?data.text:(data.itemText||""));this.obj.td_b.innerHTML = "<div class='btn_sel_text'>"+itemText+"</div>";this.obj.tr[that._isIPad?"ontouchstart":"onmouseover"] = function() {if (!this.en || (this._selected && self.renderSelect)) return;this.className = "tr_btn tr_btn_over";}
 
 this.obj.tr.onmouseout = function() {if (!this.en)return;if (this._selected && self.renderSelect){if (String(this.className).search("tr_btn_selected") == -1) this.className = "tr_btn tr_btn_selected";}else {this.className = "tr_btn";}
 }
 
 this.obj.tr[that._isIPad?"ontouchend":"onclick"] = function(e) {e = e||event;e.cancelBubble = true;if (!this.en)return;self.setListOptionSelected(this.idd.replace(that.idPrefix,""));self.obj.renderAs = "dhx_toolbar_btn def";self.obj.className = self.obj.renderAs;self.arw.className = String(self.obj.renderAs).replace("btn","arw");self.polygon.style.display = "none";if (self.polygon._ie6cover)self.polygon._ie6cover.style.display = "none";if (that.skin == "dhx_terrace")that._improveTerraceButtonSelect(self.id, true);that.anyUsed = "none";var id = this.idd.replace(that.idPrefix,"");if (this.extAction)try {window[this.extAction](id);}catch(e){};that.callEvent("onClick", [id]);}
 self._listOptions[id] = this.obj;return this;}
 
 
 this.polygon = document.createElement("DIV");this.polygon.dir = "ltr";this.polygon.style.display = "none";this.polygon.style.zIndex = 101;this.polygon.className = "dhx_toolbar_poly_"+that.iconSize+"_"+that.skin+(that.rtl?" rtl":"");this.polygon.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.polygon.style.overflowY = "auto";if (that._isIPad){this.polygon.ontouchstart = function(e){e = e||event;e.returnValue = false;e.cancelBubble = true;return false;}
 }
 
 
 
 this.p_tbl = document.createElement("TABLE");this.p_tbl.className = "buttons_cont";this.p_tbl.cellSpacing = "0";this.p_tbl.cellPadding = "0";this.p_tbl.border = "0";this.polygon.appendChild(this.p_tbl);this.p_tbody = document.createElement("TBODY");this.p_tbl.appendChild(this.p_tbody);if (data.items){for (var q=0;q<data.items.length;q++){var t = "_"+(data.items[q].type||"")+"ButtonSelectObject";if (typeof(this[t])== "function") new this[t](data.items[q].id||that._genStr(24),data.items[q]);}
 }
 
 document.body.appendChild(this.polygon);if (that._isIE6){this.polygon._ie6cover = document.createElement("IFRAME");this.polygon._ie6cover.frameBorder = 0;this.polygon._ie6cover.style.position = "absolute";this.polygon._ie6cover.style.border = "none";this.polygon._ie6cover.style.backgroundColor = "#000000";this.polygon._ie6cover.style.filter = "alpha(opacity=100)";this.polygon._ie6cover.style.display = "none";this.polygon._ie6cover.setAttribute("src","javascript:false;");document.body.appendChild(this.polygon._ie6cover);}
 
 
 
 this.setWidth = function(width) {this.obj.style.width = width-this.arw.offsetWidth+"px";this.polygon.style.width = this.obj.offsetWidth+this.arw.offsetWidth-2+"px";this.p_tbl.style.width = this.polygon.style.width;}
 this.enableItem = function() {that._enableItem(this);}
 this.disableItem = function() {that._disableItem(this);}
 this.isEnabled = function() {return this.state;}
 this.showItem = function() {this.obj.style.display = "";this.arw.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";this.arw.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 this.setItemText = function(text) {that._setItemText(this, text);}
 this.getItemText = function() {return that._getItemText(this);}
 this.setItemImage = function(url) {that._setItemImage(this, url, true);}
 this.clearItemImage = function() {that._clearItemImage(this, true);}
 this.setItemImageDis = function(url) {that._setItemImage(this, url, false);}
 this.clearItemImageDis = function() {that._clearItemImage(this, false);}
 this.setItemToolTip = function(tip) {this.obj.title = tip;this.arw.title = tip;}
 this.getItemToolTip = function() {return this.obj.title;}
 
 
 this.addListOption = function(id, pos, type, text, img) {if (!(type == "button" || type == "separator")) return;var dataItem = {id:id,type:type,text:text,img:img};new this["_"+type+"ButtonSelectObject"](id, dataItem, pos);}
 
 this.removeListOption = function(id) {if (!this._isListButton(id, true)) return;var item = this._listOptions[id];if (item.td_a != null && item.td_b != null){item.td_a.onselectstart = null;item.td_b.onselectstart = null;while (item.td_a.childNodes.length > 0)item.td_a.removeChild(item.td_a.childNodes[0]);while (item.td_b.childNodes.length > 0)item.td_b.removeChild(item.td_b.childNodes[0]);item.tr.onselectstart = null;item.tr.onmouseover = null;item.tr.onmouseout = null;item.tr.onclick = null;while (item.tr.childNodes.length > 0)item.tr.removeChild(item.tr.childNodes[0]);item.tr.parentNode.removeChild(item.tr);item.td_a = null;item.td_b = null;item.tr = null;}else {item.sep.onselectstart = null;item.td.onselectstart = null;item.tr.onselectstart = null;while (item.td.childNodes.length > 0)item.td.removeChild(item.td.childNodes[0]);while (item.tr.childNodes.length > 0)item.tr.removeChild(item.tr.childNodes[0]);item.tr.parentNode.removeChild(item.tr);item.sep = null;item.td = null;item.tr = null;}
 item = null;this._listOptions[id] = null;try {delete this._listOptions[id];}catch(e) {}
 }
 
 this.showListOption = function(id) {if (!this._isListButton(id, true)) return;this._listOptions[id].tr.style.display = "";}
 
 this.hideListOption = function(id) {if (!this._isListButton(id, true)) return;this._listOptions[id].tr.style.display = "none";}
 
 this.isListOptionVisible = function(id) {if (!this._isListButton(id, true)) return;return (this._listOptions[id].tr.style.display != "none");}
 
 this.enableListOption = function(id) {if (!this._isListButton(id)) return;this._listOptions[id].tr.en = true;this._listOptions[id].tr.className = "tr_btn"+(this._listOptions[id].tr._selected&&that.renderSelect?" tr_btn_selected":"");}
 
 this.disableListOption = function(id) {if (!this._isListButton(id)) return;this._listOptions[id].tr.en = false;this._listOptions[id].tr.className = "tr_btn tr_btn_disabled";}
 
 this.isListOptionEnabled = function(id) {if (!this._isListButton(id)) return;return this._listOptions[id].tr.en;}
 
 this.setListOptionPosition = function(id, pos) {if (!this._listOptions[id] || this.getListOptionPosition(id)== pos || isNaN(pos)) return;if (pos < 1)pos = 1;var tr = this._listOptions[id].tr;this.p_tbody.removeChild(tr);if (pos > this.p_tbody.childNodes.length)this.p_tbody.appendChild(tr);else this.p_tbody.insertBefore(tr, this.p_tbody.childNodes[pos-1]);tr = null;}
 
 this.getListOptionPosition = function(id) {var pos = -1;if (!this._listOptions[id])return pos;for (var q=0;q<this.p_tbody.childNodes.length;q++)if (this.p_tbody.childNodes[q] == this._listOptions[id].tr)pos=q+1;return pos;}
 
 this.setListOptionImage = function(id, img) {if (!this._isListButton(id)) return;var td = this._listOptions[id].tr.childNodes[(that.rtl?1:0)];if (td.childNodes.length > 0){td.childNodes[0].src = that.imagePath+img;}else {var imgObj = document.createElement("IMG");imgObj.className = "btn_sel_img";imgObj.src = that.imagePath+img;td.appendChild(imgObj);}
 td = null;}
 
 this.getListOptionImage = function(id) {if (!this._isListButton(id)) return;var td = this._listOptions[id].tr.childNodes[(that.rtl?1:0)];var src = null;if (td.childNodes.length > 0)src = td.childNodes[0].src;td = null;return src;}
 
 this.clearListOptionImage = function(id) {if (!this._isListButton(id)) return;var td = this._listOptions[id].tr.childNodes[(that.rtl?1:0)];while (td.childNodes.length > 0)td.removeChild(td.childNodes[0]);td = null;}
 
 this.setListOptionText = function(id, text) {if (!this._isListButton(id)) return;this._listOptions[id].tr.childNodes[(that.rtl?0:1)].childNodes[0].innerHTML = text;}
 
 this.getListOptionText = function(id) {if (!this._isListButton(id)) return;return this._listOptions[id].tr.childNodes[(that.rtl?0:1)].childNodes[0].innerHTML;}
 
 this.setListOptionToolTip = function(id, tip) {if (!this._isListButton(id)) return;this._listOptions[id].tr.title = tip;}
 
 this.getListOptionToolTip = function(id) {if (!this._isListButton(id)) return;return this._listOptions[id].tr.title;}
 
 this.forEachListOption = function(handler) {for (var a in this._listOptions)handler(a);}
 
 this.getAllListOptions = function() {var listData = new Array();for (var a in this._listOptions)listData[listData.length] = a;return listData;}
 
 this.setListOptionSelected = function(id) {for (var a in this._listOptions){var item = this._listOptions[a];if (item.td_a != null && item.td_b != null && item.tr.en){if (a == id){item.tr._selected = true;item.tr.className = "tr_btn"+(this.renderSelect?" tr_btn_selected":"");if (this.mode == "select"){if (item.tr._img)this.setItemImage(item.tr._img);else this.clearItemImage();this.setItemText(this.getListOptionText(id));}
 }else {item.tr._selected = false;item.tr.className = "tr_btn";}
 }
 item = null;}
 }
 
 this.getListOptionSelected = function() {var id = null;for (var a in this._listOptions)if (this._listOptions[a].tr._selected == true)id = a;return id;}
 
 this._isListButton = function(id, allowSeparator) {if (this._listOptions[id] == null)return false;if (!allowSeparator && this._listOptions[id].tr.className == "tr_sep")return false;return true;}
 
 this.setMaxOpen = function(r) {this._ph = null;if (typeof(r)== "number") {this.maxOpen = r;this._maxOpenTest();return;}
 this.maxOpen = null;}
 
 if (data.width)this.setWidth(data.width);if (this.mode == "select" && typeof(data.selected)!= "undefined") this.setListOptionSelected(data.selected);return this;}
 


dhtmlXToolbarObject.prototype._buttonInputObject = function(that, id, data) {this.id = that.idPrefix+id;this.obj = document.createElement("DIV");this.obj.className = "dhx_toolbar_btn def";this.obj.style.display = (data.hidden!=null?"none":"");this.obj.idd = String(id);this.obj.w = (data.width!=null?data.width:100);this.obj.title = (data.title!=null?data.title:"");this.obj.innerHTML = "<input class='inp' type='text' style='-moz-user-select:text;width:"+this.obj.w+"px;'"+(data.value!=null?" value='"+data.value+"'":"")+">";var th = that;var self = this;this.obj.childNodes[0].onkeydown = function(e) {e = e||event;if (e.keyCode == 13){th.callEvent("onEnter", [self.obj.idd, this.value]);}
 }
 
 that.base.appendChild(this.obj);this.enableItem = function() {this.obj.childNodes[0].disabled = false;}
 this.disableItem = function() {this.obj.childNodes[0].disabled = true;}
 this.isEnabled = function() {return (!this.obj.childNodes[0].disabled);}
 this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display != "none");}
 this.setValue = function(value) {this.obj.childNodes[0].value = value;}
 this.getValue = function() {return this.obj.childNodes[0].value;}
 this.setWidth = function(width) {this.obj.w = width;this.obj.childNodes[0].style.width = this.obj.w+"px";}
 this.getWidth = function() {return this.obj.w;}
 this.setItemToolTip = function(tip) {this.obj.title = tip;}
 this.getItemToolTip = function() {return this.obj.title;}
 this.getInput = function() {return this.obj.firstChild;}
 
 return this;}
dhtmlXToolbarObject.prototype._buttonTwoStateObject = function(that, id, data) {this.id = that.idPrefix+id;this.state = (data.enabled!=null?false:true);this.imgEn = (data.img!=null?data.img:"");this.imgDis = (data.imgdis!=null?data.imgdis:"");this.img = (this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.obj = document.createElement("DIV");this.obj.pressed = (data.selected!=null);this.obj.extAction = (data.action||null);this.obj.className = "dhx_toolbar_btn "+(this.obj.pressed?"pres"+(this.state?"":"_dis"):(this.state?"def":"dis"));this.obj.style.display = (data.hidden!=null?"none":"");this.obj.renderAs = this.obj.className;this.obj.idd = String(id);this.obj.title = (data.title||"");if (this.obj.pressed){this.obj.renderAs = "dhx_toolbar_btn over";}
 
 this.obj.innerHTML = that._rtlParseBtn((this.img!=""?"<img src='"+that.imagePath+this.img+"'>":""),(data.text!=null?"<div>"+data.text+"</div>":""));that.base.appendChild(this.obj);var obj = this;this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.obj.onmouseover = function() {this._doOnMouseOver();}
 this.obj.onmouseout = function() {this._doOnMouseOut();}
 this.obj._doOnMouseOver = function() {if (obj.state == false)return;if (that.anyUsed != "none")return;if (this.pressed){this.renderAs = "dhx_toolbar_btn over";return;}
 this.className = "dhx_toolbar_btn over";this.renderAs = this.className;}
 this.obj._doOnMouseOut = function() {if (obj.state == false)return;if (that.anyUsed != "none")return;if (this.pressed){this.renderAs = "dhx_toolbar_btn def";return;}
 this.className = "dhx_toolbar_btn def";this.renderAs = this.className;}
 this.obj[that._isIPad?"ontouchstart":"onmousedown"] = function(e) {if (that.checkEvent("onBeforeStateChange")) if (!that.callEvent("onBeforeStateChange", [this.idd.replace(that.idPrefix, ""), this.pressed])) return;if (obj.state == false)return;if (that.anyUsed != "none")return;this.pressed = !this.pressed;this.className = (this.pressed?"dhx_toolbar_btn pres":this.renderAs);var id = this.idd.replace(that.idPrefix, "");if (this.extAction)try {window[this.extAction](id, this.pressed);}catch(e){};that.callEvent("onStateChange", [id, this.pressed]);return false;}
 
 
 this.setItemState = function(state, callEvent) {if (this.obj.pressed != state){if (state == true){this.obj.pressed = true;this.obj.className = "dhx_toolbar_btn pres"+(this.state?"":"_dis");this.obj.renderAs = "dhx_toolbar_btn over";}else {this.obj.pressed = false;this.obj.className = "dhx_toolbar_btn "+(this.state?"def":"dis");this.obj.renderAs = this.obj.className;}
 if (callEvent == true){var id = this.obj.idd.replace(that.idPrefix, "");if (this.obj.extAction)try {window[this.obj.extAction](id, this.obj.pressed);}catch(e){};that.callEvent("onStateChange", [id, this.obj.pressed]);}
 }
 }
 this.getItemState = function() {return this.obj.pressed;}
 this.enableItem = function() {that._enableItem(this);}
 this.disableItem = function() {that._disableItem(this);}
 this.isEnabled = function() {return this.state;}
 this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 this.setItemText = function(text) {that._setItemText(this, text);}
 this.getItemText = function() {return that._getItemText(this);}
 this.setItemImage = function(url) {that._setItemImage(this, url, true);}
 this.clearItemImage = function() {that._clearItemImage(this, true);}
 this.setItemImageDis = function(url) {that._setItemImage(this, url, false);}
 this.clearItemImageDis = function() {that._clearItemImage(this, false);}
 this.setItemToolTip = function(tip) {this.obj.title = tip;}
 this.getItemToolTip = function() {return this.obj.title;}
 
 return this;}
dhtmlXToolbarObject.prototype._sliderObject = function(that, id, data) {this.id = that.idPrefix+id;this.state = (data.enabled!=null?(data.enabled=="true"?true:false):true);this.obj = document.createElement("DIV");this.obj.className = "dhx_toolbar_btn "+(this.state?"def":"dis");this.obj.style.display = (data.hidden!=null?"none":"");this.obj.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.obj.idd = String(id);this.obj.len = (data.length!=null?Number(data.length):50);this.obj.innerHTML = "<div>"+(data.textMin||"")+"</div>"+
 "<div class='sl_bg_l'></div>"+
 "<div class='sl_bg_m' style='width:"+this.obj.len+"px;'></div>"+
 "<div class='sl_bg_r'></div>"+
 "<div>"+(data.textMax||"")+"</div>";that.base.appendChild(this.obj);var self = this;this.pen = document.createElement("DIV");this.pen.className = "sl_pen";this.obj.appendChild(this.pen);var pen = this.pen;this.label = document.createElement("DIV");this.label.dir = "ltr";this.label.className = "dhx_toolbar_slider_label_"+that.skin+(that.rtl?"_rtl":"");this.label.style.display = "none";this.label.tip = (data.toolTip||"%v");document.body.appendChild(this.label);var label = this.label;this.pen.valueMin = (data.valueMin!=null?Number(data.valueMin):0);this.pen.valueMax = (data.valueMax!=null?Number(data.valueMax):100);if (this.pen.valueMin > this.pen.valueMax)this.pen.valueMin = this.pen.valueMax;this.pen.valueNow = (data.valueNow!=null?Number(data.valueNow):this.pen.valueMax);if (this.pen.valueNow > this.pen.valueMax)this.pen.valueNow = this.pen.valueMax;if (this.pen.valueNow < this.pen.valueMin)this.pen.valueNow = this.pen.valueMin;this.pen._detectLimits = function() {this.minX = self.obj.childNodes[1].offsetLeft-4;this.maxX = self.obj.childNodes[3].offsetLeft-this.offsetWidth+1;}
 this.pen._detectLimits();this.pen._definePos = function() {this.nowX = Math.round((this.valueNow-this.valueMin)*(this.maxX-this.minX)/(this.valueMax-this.valueMin)+this.minX);this.style.left = this.nowX+"px";this.newNowX = this.nowX;}
 this.pen._definePos();this.pen.initXY = 0;this.pen.allowMove = false;this.pen[that._isIPad?"ontouchstart":"onmousedown"] = function(e) {if (self.state == false)return;e = e||event;this.initXY = (that._isIPad?e.touches[0].clientX:e.clientX);this.newValueNow = this.valueNow;this.allowMove = true;this.className = "sl_pen over";if (label.tip != ""){label.style.visibility = "hidden";label.style.display = "";label.innerHTML = label.tip.replace("%v", this.valueNow);label.style.left = Math.round(getAbsoluteLeft(this)+this.offsetWidth/2-label.offsetWidth/2)+"px";label.style.top = getAbsoluteTop(this)-label.offsetHeight-3+"px";label.style.visibility = "";}
 }
 
 this.pen._doOnMouseMoveStart = function(e) {e=e||event;if (!pen.allowMove)return;var ecx = (that._isIPad?e.touches[0].clientX:e.clientX);var ofst = ecx - pen.initXY;if (ecx < getAbsoluteLeft(pen)+Math.round(pen.offsetWidth/2) && pen.nowX == pen.minX) return;if (ecx > getAbsoluteLeft(pen)+Math.round(pen.offsetWidth/2) && pen.nowX == pen.maxX) return;pen.newNowX = pen.nowX + ofst;if (pen.newNowX < pen.minX)pen.newNowX = pen.minX;if (pen.newNowX > pen.maxX)pen.newNowX = pen.maxX;pen.nowX = pen.newNowX;pen.style.left = pen.nowX+"px";pen.initXY = ecx;pen.newValueNow = Math.round((pen.valueMax-pen.valueMin)*(pen.newNowX-pen.minX)/(pen.maxX-pen.minX)+pen.valueMin);if (label.tip != ""){label.innerHTML = label.tip.replace(/%v/gi, pen.newValueNow);label.style.left = Math.round(getAbsoluteLeft(pen)+pen.offsetWidth/2-label.offsetWidth/2)+"px";label.style.top = getAbsoluteTop(pen)-label.offsetHeight-3+"px";}
 e.cancelBubble = true;e.returnValue = false;return false;}
 this.pen._doOnMouseMoveEnd = function() {if (!pen.allowMove)return;pen.className = "sl_pen";pen.allowMove = false;pen.nowX = pen.newNowX;pen.valueNow = pen.newValueNow;if (label.tip != "")label.style.display = "none";that.callEvent("onValueChange", [self.obj.idd.replace(that.idPrefix, ""), pen.valueNow]);}
 
 if (that._isIPad){document.addEventListener("touchmove", pen._doOnMouseMoveStart, false);document.addEventListener("touchend", pen._doOnMouseMoveEnd, false);}else {if (_isIE){document.body.attachEvent("onmousemove", pen._doOnMouseMoveStart);document.body.attachEvent("onmouseup", pen._doOnMouseMoveEnd);}else {window.addEventListener("mousemove", pen._doOnMouseMoveStart, false);window.addEventListener("mouseup", pen._doOnMouseMoveEnd, false);}
 }
 
 this.enableItem = function() {if (this.state)return;this.state = true;this.obj.className = "dhx_toolbar_btn def";}
 this.disableItem = function() {if (!this.state)return;this.state = false;this.obj.className = "dhx_toolbar_btn dis";}
 this.isEnabled = function() {return this.state;}
 this.showItem = function() {this.obj.style.display = "";}
 this.hideItem = function() {this.obj.style.display = "none";}
 this.isVisible = function() {return (this.obj.style.display == "");}
 this.setValue = function(value, callEvent) {value = Number(value);if (value < this.pen.valueMin)value = this.pen.valueMin;if (value > this.pen.valueMax)value = this.pen.valueMax;this.pen.valueNow = value;this.pen._definePos();if (callEvent == true)that.callEvent("onValueChange", [this.obj.idd.replace(that.idPrefix, ""), this.pen.valueNow]);}
 this.getValue = function() {return this.pen.valueNow;}
 this.setMinValue = function(value, label) {value = Number(value);if (value > this.pen.valueMax)return;this.obj.childNodes[0].innerHTML = label;this.obj.childNodes[0].style.display = (label.length>0?"":"none");this.pen.valueMin = value;if (this.pen.valueNow < this.pen.valueMin)this.pen.valueNow = this.pen.valueMin;this.pen._detectLimits();this.pen._definePos();}
 this.setMaxValue = function(value, label) {value = Number(value);if (value < this.pen.valueMin)return;this.obj.childNodes[4].innerHTML = label;this.obj.childNodes[4].style.display = (label.length>0?"":"none");this.pen.valueMax = value;if (this.pen.valueNow > this.pen.valueMax)this.pen.valueNow = this.pen.valueMax;this.pen._detectLimits();this.pen._definePos();}
 this.getMinValue = function() {var label = this.obj.childNodes[0].innerHTML;var value = this.pen.valueMin;return new Array(value, label);}
 this.getMaxValue = function() {var label = this.obj.childNodes[4].innerHTML;var value = this.pen.valueMax;return new Array(value, label);}
 this.setItemToolTipTemplate = function(template) {this.label.tip = template;}
 this.getItemToolTipTemplate = function() {return this.label.tip;}
 
 return this;}
dhtmlXToolbarObject.prototype.unload = function() {if (this._isIPad){document.removeEventListener("touchstart", this._doOnClick, false);}else {if (_isIE)document.body.detachEvent("onclick", this._doOnClick);else window.removeEventListener("click", this._doOnClick, false);}
 this._doOnClick = null;this.clearAll();this.objPull = null;if (this._xmlLoader){this._xmlLoader.destructor();this._xmlLoader = null;}
 
 while (this.base.childNodes.length > 0)this.base.removeChild(this.base.childNodes[0]);this.cont.removeChild(this.base);this.base = null;while (this.cont.childNodes.length > 0)this.cont.removeChild(this.cont.childNodes[0]);this.cont.className = "";this.cont = null;this.detachAllEvents();this.tX1 = null;this.tX2 = null;this.tY1 = null;this.tY2 = null;this._isIE6 = null;this._isWebToolbar = null;this.align = null;this.anyUsed = null;this.idPrefix = null;this.imagePath = null;this.rootTypes = null;this.selectPolygonOffsetLeft = null;this.selectPolygonOffsetTop = null;this.skin = null;this._rtl = null;this._rtlParseBtn = null;this.setRTL = null;this._sbw = null;this._getObj = null;this._addImgObj = null;this._setItemImage = null;this._clearItemImage = null;this._setItemText = null;this._getItemText = null;this._enableItem = null;this._disableItem = null;this._xmlParser = null;this._doOnLoad = null;this._addItemToStorage = null;this._genStr = null;this._addItem = null;this._getPosition = null;this._setPosition = null;this._getIdByPosition = null;this._separatorObject = null;this._textObject = null;this._buttonObject = null;this._buttonSelectObject = null;this._buttonInputObject = null;this._buttonTwoStateObject = null;this._sliderObject = null;this._autoDetectVisibleArea = null;this._removeItem = null;this.setAlign = null;this.setSkin = null;this.setIconsPath = null;this.setIconPath = null;this.loadXML = null;this.loadXMLString = null;this.attachEvent = null;this.callEvent = null;this.checkEvent = null;this.eventCatcher = null;this.detachEvent = null;this.detachAllEvents = null;this.clearAll = null;this.addSpacer = null;this.removeSpacer = null;this.getType = null;this.getTypeExt = null;this.inArray = null;this.getParentId = null;this.addButton = null;this.addText = null;this.addButtonSelect = null;this.addButtonTwoState = null;this.addSeparator = null;this.addSlider = null;this.addInput = null;this.forEachItem = null;this.showItem = null;this.hideItem = null;this.isVisible = null;this.enableItem = null;this.disableItem = null;this.isEnabled = null;this.setItemText = null;this.getItemText = null;this.setItemToolTip = null;this.getItemToolTip = null;this.setItemImage = null;this.setItemImageDis = null;this.clearItemImage = null;this.clearItemImageDis = null;this.setItemState = null;this.getItemState = null;this.setItemToolTipTemplate = null;this.getItemToolTipTemplate = null;this.setValue = null;this.getValue = null;this.setMinValue = null;this.getMinValue = null;this.setMaxValue = null;this.getMaxValue = null;this.setWidth = null;this.getWidth = null;this.getPosition = null;this.setPosition = null;this.removeItem = null;this.addListOption = null;this.removeListOption = null;this.showListOption = null;this.hideListOption = null;this.isListOptionVisible = null;this.enableListOption = null;this.disableListOption = null;this.isListOptionEnabled = null;this.setListOptionPosition = null;this.getListOptionPosition = null;this.setListOptionText = null;this.getListOptionText = null;this.setListOptionToolTip = null;this.getListOptionToolTip = null;this.setListOptionImage = null;this.getListOptionImage = null;this.clearListOptionImage = null;this.forEachListOption = null;this.getAllListOptions = null;this.setListOptionSelected = null;this.getListOptionSelected = null;this.unload = null;this.setUserData = null;this.getUserData = null;this.setMaxOpen = null;this.items = null;};dhtmlXToolbarObject.prototype._autoDetectVisibleArea = function() {this.tX1 = document.body.scrollLeft;this.tX2 = this.tX1+(window.innerWidth||document.body.clientWidth);this.tY1 = Math.max((_isIE?document.documentElement:document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);this.tY2 = this.tY1+(_isIE?Math.max(document.documentElement.clientHeight||0,document.documentElement.offsetHeight||0,document.body.clientHeight||0):window.innerHeight);};dhtmlXToolbarObject.prototype.setUserData = function(id, name, value) {if (this.objPull[this.idPrefix+id] == null)return;var item = this.objPull[this.idPrefix+id];if (item.userData == null)item.userData = {};item.userData[name] = value;};dhtmlXToolbarObject.prototype.getUserData = function(id, name) {if (this.objPull[this.idPrefix+id] == null)return null;if (this.objPull[this.idPrefix+id].userData == null)return null;if (this.objPull[this.idPrefix+id].userData[name] == null)return null;return this.objPull[this.idPrefix+id].userData[name];};dhtmlXToolbarObject.prototype._isListOptionExists = function(listId, optionId) {if (this.objPull[this.idPrefix+listId] == null)return false;var item = this.objPull[this.idPrefix+listId];if (item.type != "buttonSelect")return false;if (item._listOptions[optionId] == null)return false;return true;};dhtmlXToolbarObject.prototype.setListOptionUserData = function(listId, optionId, name, value) {if (!this._isListOptionExists(listId, optionId)) return;var opt = this.objPull[this.idPrefix+listId]._listOptions[optionId];if (opt.userData == null)opt.userData = {};opt.userData[name] = value;};dhtmlXToolbarObject.prototype.getListOptionUserData = function(listId, optionId, name) {if (!this._isListOptionExists(listId, optionId)) return null;var opt = this.objPull[this.idPrefix+listId]._listOptions[optionId];if (!opt.userData)return null;return (opt.userData[name]?opt.userData[name]:null);};(function(){dhtmlx.extend_api("dhtmlXToolbarObject",{_init:function(obj){return [obj.parent, obj.skin];},
 icon_path:"setIconsPath",
 xml:"loadXML",
 items:"items",
 align:"setAlign",
 rtl:"setRTL",
 skin:"setSkin"
 },{items:function(arr){for (var i=0;i < arr.length;i++){var item = arr[i];if (item.type == "button")this.addButton(item.id, null, item.text, item.img, item.img_disabled);if (item.type == "separator")this.addSeparator(item.id, null);if (item.type == "text")this.addText(item.id, null, item.text);if (item.type == "buttonSelect")this.addButtonSelect(item.id, null, item.text, item.options, item.img, item.img_disabled, item.renderSelect, item.openAll, item.maxOpen);if (item.type == "buttonTwoState")this.addButtonTwoState(item.id, null, item.text, item.img, item.img_disabled);if (item.type == "buttonInput")this.addInput(item.id, null, item.text);if (item.type == "slider")this.addSlider(item.id, null, item.length, item.value_min, item.value_max, item.value_now, item.text_min, item.text_max, item.tip_template);if (item.width)this.setWidth(item.id, item.width);if (item.disabled)this.disableItem(item.id);if (item.tooltip)this.setItemToolTip(item.id, item.tooltip);if (item.pressed === true)this.setItemState(item.id, true);}
 }
 });})();function xmlPointer(data){this.d=data;}
xmlPointer.prototype={text:function(){if (!_isFF)return this.d.xml;var x = new XMLSerializer();return x.serializeToString(this.d);},
 get:function(name){return this.d.getAttribute(name);},
 exists:function(){return !!this.d },
 content:function(){return this.d.firstChild?this.d.firstChild.data:"";}, 
 each:function(name,f,t,i){var a=this.d.childNodes;var c=new xmlPointer();if (a.length)for (i=i||0;i<a.length;i++)if (a[i].tagName==name){c.d=a[i];if(f.apply(t,[c,i])==-1) return;}},
 get_all:function(){var a={};var b=this.d.attributes;for (var i=0;i<b.length;i++)a[b[i].name]=b[i].value;return a;},
 sub:function(name){var a=this.d.childNodes;var c=new xmlPointer();if (a.length)for (var i=0;i<a.length;i++)if (a[i].tagName==name){c.d=a[i];return c;}},
 up:function(name){return new xmlPointer(this.d.parentNode);},
 set:function(name,val){this.d.setAttribute(name,val);},
 clone:function(name){return new xmlPointer(this.d);},
 sub_exists:function(name){var a=this.d.childNodes;if (a.length)for (var i=0;i<a.length;i++)if (a[i].tagName==name)return true;return false;},
 through:function(name,rule,v,f,t){var a=this.d.childNodes;if (a.length)for (var i=0;i<a.length;i++){if (a[i].tagName==name && a[i].getAttribute(rule)!=null && a[i].getAttribute(rule)!="" && (!v || a[i].getAttribute(rule)==v )) {var c=new xmlPointer(a[i]);f.apply(t,[c,i]);}var w=this.d;this.d=a[i];this.through(name,rule,v,f,t);this.d=w;}}
}
function dhtmlXTreeObject(htmlObject, width, height, rootId){if (_isIE)try {document.execCommand("BackgroundImageCache", false, true);}catch (e){}
 if (typeof(htmlObject)!="object")
 this.parentObject=document.getElementById(htmlObject);else
 this.parentObject=htmlObject;this.parentObject.style.overflow="hidden";this._itim_dg=true;this.dlmtr=",";this.dropLower=false;this.enableIEImageFix();this.xmlstate=0;this.mytype="tree";this.smcheck=true;this.width=width;this.height=height;this.rootId=rootId;this.childCalc=null;this.def_img_x="18px";this.def_img_y="18px";this.def_line_img_x="18px";this.def_line_img_y="18px";this._dragged=new Array();this._selected=new Array();this.style_pointer="pointer";this._aimgs=true;this.htmlcA=" [";this.htmlcB="]";this.lWin=window;this.cMenu=0;this.mlitems=0;this.iconURL="";this.dadmode=0;this.slowParse=false;this.autoScroll=true;this.hfMode=0;this.nodeCut=new Array();this.XMLsource=0;this.XMLloadingWarning=0;this._idpull={};this._pullSize=0;this.treeLinesOn=true;this.tscheck=false;this.timgen=true;this.dpcpy=false;this._ld_id=null;this._oie_onXLE=[];this.imPath=window.dhx_globalImgPath||"";this.checkArray=new Array("iconUncheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif","iconCheckDis.gif","iconCheckDis.gif");this.radioArray=new Array("radio_off.gif","radio_on.gif","radio_on.gif","radio_off.gif","radio_on.gif","radio_on.gif");this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif","line1.gif");this.minusArray=new Array("minus2.gif","minus3.gif","minus4.gif","minus.gif","minus5.gif");this.plusArray=new Array("plus2.gif","plus3.gif","plus4.gif","plus.gif","plus5.gif");this.imageArray=new Array("leaf.gif","folderOpen.gif","folderClosed.gif");this.cutImg= new Array(0,0,0);this.cutImage="but_cut.gif";dhtmlxEventable(this);this.dragger= new dhtmlDragAndDropObject();this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";this.allTree=this._createSelf();this.allTree.appendChild(this.htmlNode.htmlNode);if(_isFF){this.allTree.childNodes[0].width="100%";this.allTree.childNodes[0].style.overflow="hidden";}
 var self=this;this.allTree.onselectstart=new Function("return false;");if (_isMacOS)this.allTree.oncontextmenu = function(e){return self._doContClick(e||window.event, true);};this.allTree.onmousedown = function(e){return self._doContClick(e||window.event);};this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this,true,this.no_cashe);if (_isIE)this.preventIECashing(true);if (window.addEventListener)window.addEventListener("unload",function(){try{self.destructor();}catch(e){}},false);if (window.attachEvent)window.attachEvent("onunload",function(){try{self.destructor();}catch(e){}});this.setImagesPath=this.setImagePath;this.setIconsPath=this.setIconPath;if (dhtmlx.image_path)this.setImagePath(dhtmlx.image_path);if (dhtmlx.skin)this.setSkin(dhtmlx.skin);return this;};dhtmlXTreeObject.prototype.setDataMode=function(mode){this._datamode=mode;}
 
dhtmlXTreeObject.prototype._doContClick=function(ev, force){if (!force && ev.button!=2){if(this._acMenu){if (this._acMenu.hideContextMenu)this._acMenu.hideContextMenu()
 else
 this.cMenu._contextEnd();}
 return true;}
 
 

 
 var el=(_isIE?ev.srcElement:ev.target);while ((el)&&(el.tagName!="BODY")) {if (el.parentObject)break;el=el.parentNode;}
 
 if ((!el)||(!el.parentObject)) return true;var obj=el.parentObject;if (!this.callEvent("onRightClick",[obj.id,ev]))
 (ev.srcElement||ev.target).oncontextmenu = function(e){(e||event).cancelBubble=true;return false;};this._acMenu=(obj.cMenu||this.cMenu);if (this._acMenu){if (!(this.callEvent("onBeforeContextMenu", [
 obj.id
 ]))) return true;(ev.srcElement||ev.target).oncontextmenu = function(e){(e||event).cancelBubble=true;return false;};if (this._acMenu.showContextMenu){var dEl0=window.document.documentElement;var dEl1=window.document.body;var corrector = new Array((dEl0.scrollLeft||dEl1.scrollLeft),(dEl0.scrollTop||dEl1.scrollTop));if (_isIE){var x= ev.clientX+corrector[0];var y = ev.clientY+corrector[1];}else {var x= ev.pageX;var y = ev.pageY;}
 
 this._acMenu.showContextMenu(x-1,y-1)
 this.contextID=obj.id;ev.cancelBubble=true;this._acMenu._skip_hide=true;}else {el.contextMenuId=obj.id;el.contextMenu=this._acMenu;el.a=this._acMenu._contextStart;el.a(el, ev);el.a=null;}
 
 return false;}
 return true;}
dhtmlXTreeObject.prototype.enableIEImageFix=function(mode){if (!mode){this._getImg=function(id){return document.createElement((id==this.rootId)?"div":"img");}
 this._setSrc=function(a,b){a.src=b;}
 this._getSrc=function(a){return a.src;}
 }else {this._getImg=function(){var z=document.createElement("DIV");z.innerHTML="&nbsp;";z.className="dhx_bg_img_fix";return z;}
 this._setSrc=function(a,b){a.style.backgroundImage="url("+b+")";}
 this._getSrc=function(a){var z=a.style.backgroundImage;return z.substr(4,z.length-5).replace(/(^")|("$)/g,"");}
 }
}
dhtmlXTreeObject.prototype.destructor=function(){for (var a in this._idpull){var z=this._idpull[a];if (!z)continue;z.parentObject=null;z.treeNod=null;z.childNodes=null;z.span=null;z.tr.nodem=null;z.tr=null;z.htmlNode.objBelong=null;z.htmlNode=null;this._idpull[a]=null;}
 this.parentObject.innerHTML="";if(this.XMLLoader)this.XMLLoader.destructor();this.allTree.onselectstart = null;this.allTree.oncontextmenu = null;this.allTree.onmousedown = null;for(var a in this){this[a]=null;}
}
function cObject(){return this;}
cObject.prototype= new Object;cObject.prototype.clone = function () {function _dummy(){};_dummy.prototype=this;return new _dummy();}
function dhtmlXTreeItemObject(itemId,itemText,parentObject,treeObject,actionHandler,mode){this.htmlNode="";this.acolor="";this.scolor="";this.tr=0;this.childsCount=0;this.tempDOMM=0;this.tempDOMU=0;this.dragSpan=0;this.dragMove=0;this.span=0;this.closeble=1;this.childNodes=new Array();this.userData=new cObject();this.checkstate=0;this.treeNod=treeObject;this.label=itemText;this.parentObject=parentObject;this.actionHandler=actionHandler;this.images=new Array(treeObject.imageArray[0],treeObject.imageArray[1],treeObject.imageArray[2]);this.id=treeObject._globalIdStorageAdd(itemId,this);if (this.treeNod.checkBoxOff )this.htmlNode=this.treeNod._createItem(1,this,mode);else this.htmlNode=this.treeNod._createItem(0,this,mode);this.htmlNode.objBelong=this;return this;};dhtmlXTreeObject.prototype._globalIdStorageAdd=function(itemId,itemObject){if (this._globalIdStorageFind(itemId,1,1)) {itemId=itemId +"_"+(new Date()).valueOf();return this._globalIdStorageAdd(itemId,itemObject);}
 this._idpull[itemId]=itemObject;this._pullSize++;return itemId;};dhtmlXTreeObject.prototype._globalIdStorageSub=function(itemId){if (this._idpull[itemId]){this._unselectItem(this._idpull[itemId]);this._idpull[itemId]=null;this._pullSize--;}
 if ((this._locker)&&(this._locker[itemId])) this._locker[itemId]=false;};dhtmlXTreeObject.prototype._globalIdStorageFind=function(itemId,skipXMLSearch,skipParsing,isreparse){var z=this._idpull[itemId]
 if (z){return z;}
 return null;};dhtmlXTreeObject.prototype._escape=function(str){switch(this.utfesc){case "none":
 return str;break;case "utf8":
 return encodeURIComponent(str);break;default:
 return escape(str);break;}
 }
 dhtmlXTreeObject.prototype._drawNewTr=function(htmlObject,node)
 {var tr =document.createElement('tr');var td1=document.createElement('td');var td2=document.createElement('td');td1.appendChild(document.createTextNode(" "));td2.colSpan=3;td2.appendChild(htmlObject);tr.appendChild(td1);tr.appendChild(td2);return tr;};dhtmlXTreeObject.prototype.loadXMLString=function(xmlString,afterCall){var that=this;if (!this.parsCount)this.callEvent("onXLS",[that,null]);this.xmlstate=1;if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXMLString(xmlString);};dhtmlXTreeObject.prototype.loadXML=function(file,afterCall){if (this._datamode && this._datamode!="xml")return this["load"+this._datamode.toUpperCase()](file,afterCall);var that=this;if (!this.parsCount)this.callEvent("onXLS",[that,this._ld_id]);this._ld_id=null;this.xmlstate=1;this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this,true,this.no_cashe);if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXML(file);};dhtmlXTreeObject.prototype._attachChildNode=function(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,beforeNode,afterNode){if (beforeNode && beforeNode.parentObject)parentObject=beforeNode.parentObject;if (((parentObject.XMLload==0)&&(this.XMLsource))&&(!this.XMLloadingWarning))
 {parentObject.XMLload=1;this._loadDynXML(parentObject.id);}
 var Count=parentObject.childsCount;var Nodes=parentObject.childNodes;if (afterNode && afterNode.tr.previousSibling){if (afterNode.tr.previousSibling.previousSibling){beforeNode=afterNode.tr.previousSibling.nodem;}
 else
 optionStr=optionStr.replace("TOP","")+",TOP";}
 if (beforeNode){var ik,jk;for (ik=0;ik<Count;ik++)if (Nodes[ik]==beforeNode){for (jk=Count;jk!=ik;jk--)Nodes[1+jk]=Nodes[jk];break;}
 ik++;Count=ik;}
 if (optionStr){var tempStr=optionStr.split(",");for (var i=0;i<tempStr.length;i++){switch(tempStr[i])
 {case "TOP": if (parentObject.childsCount>0){beforeNode=new Object;beforeNode.tr=parentObject.childNodes[0].tr.previousSibling;}
 parentObject._has_top=true;for (ik=Count;ik>0;ik--)Nodes[ik]=Nodes[ik-1];Count=0;break;}
 };};var n;if (!(n=this._idpull[itemId])|| n.span!=-1){n=Nodes[Count]=new dhtmlXTreeItemObject(itemId,itemText,parentObject,this,itemActionHandler,1);itemId = Nodes[Count].id;parentObject.childsCount++;}
 
 if(!n.htmlNode){n.label=itemText;n.htmlNode=this._createItem((this.checkBoxOff?1:0),n);n.htmlNode.objBelong=n;}
 if(image1)n.images[0]=image1;if(image2)n.images[1]=image2;if(image3)n.images[2]=image3;var tr=this._drawNewTr(n.htmlNode);if ((this.XMLloadingWarning)||(this._hAdI))
 n.htmlNode.parentNode.parentNode.style.display="none";if ((beforeNode)&&beforeNode.tr&&(beforeNode.tr.nextSibling))
 parentObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr.nextSibling);else
 if (this.parsingOn==parentObject.id){this.parsedArray[this.parsedArray.length]=tr;}
 else
 parentObject.htmlNode.childNodes[0].appendChild(tr);if ((beforeNode)&&(!beforeNode.span)) beforeNode=null;if (this.XMLsource)if ((childs)&&(childs!=0)) n.XMLload=0;else n.XMLload=1;n.tr=tr;tr.nodem=n;if (parentObject.itemId==0)tr.childNodes[0].className="hiddenRow";if ((parentObject._r_logic)||(this._frbtr))
 this._setSrc(n.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.imPath+this.radioArray[0]);if (optionStr){var tempStr=optionStr.split(",");for (var i=0;i<tempStr.length;i++){switch(tempStr[i])
 {case "SELECT": this.selectItem(itemId,false);break;case "CALL": this.selectItem(itemId,true);break;case "CHILD": n.XMLload=0;break;case "CHECKED":
 if (this.XMLloadingWarning)this.setCheckList+=this.dlmtr+itemId;else
 this.setCheck(itemId,1);break;case "HCHECKED":
 this._setCheck(n,"unsure");break;case "OPEN": n.openMe=1;break;}
 };};if (!this.XMLloadingWarning){if ((this._getOpenState(parentObject)<0)&&(!this._hAdI)) this.openItem(parentObject.id);if (beforeNode){this._correctPlus(beforeNode);this._correctLine(beforeNode);}
 this._correctPlus(parentObject);this._correctLine(parentObject);this._correctPlus(n);if (parentObject.childsCount>=2){this._correctPlus(Nodes[parentObject.childsCount-2]);this._correctLine(Nodes[parentObject.childsCount-2]);}
 if (parentObject.childsCount!=2)this._correctPlus(Nodes[0]);if (this.tscheck)this._correctCheckStates(parentObject);if (this._onradh){if (this.xmlstate==1){var old=this.onXLE;this.onXLE=function(id){this._onradh(itemId);if (old)old(id);}
 }
 else
 this._onradh(itemId);}
 }
 return n;};dhtmlXTreeObject.prototype.insertNewItem=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children){var parentObject=this._globalIdStorageFind(parentId);if (!parentObject)return (-1);var nodez=this._attachChildNode(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children);if(!this._idpull[this.rootId].XMLload)this._idpull[this.rootId].XMLload = 1;return nodez;};dhtmlXTreeObject.prototype.insertNewChild=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children){return this.insertNewItem(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children);}

 dhtmlXTreeObject.prototype._parseXMLTree=function(a,b,c,d,xml){var p=new xmlPointer(xml.getXMLTopNode("tree"));a._parse(p);a._p=p;}
 
 dhtmlXTreeObject.prototype._parseItem=function(c,temp,preNode,befNode){var id;if (this._srnd && (!this._idpull[id=c.get("id")] || !this._idpull[id].span))
 {this._addItemSRND(temp.id,id,c);return;}
 
 var a=c.get_all();if ((typeof(this.waitUpdateXML)=="object")&&(!this.waitUpdateXML[a.id])){this._parse(c,a.id,1);return;}


 



 var zST=[];if (a.select)zST.push("SELECT");if (a.top)zST.push("TOP");if (a.call)this.nodeAskingCall=a.id;if (a.checked==-1)zST.push("HCHECKED");else if (a.checked)zST.push("CHECKED");if (a.open)zST.push("OPEN");if (this.waitUpdateXML){if (this._globalIdStorageFind(a.id))
 var newNode=this.updateItem(a.id,a.text,a.im0,a.im1,a.im2,a.checked,a.child);else{if (this.npl==0)zST.push("TOP");else preNode=temp.childNodes[this.npl];var newNode=this._attachChildNode(temp,a.id,a.text,0,a.im0,a.im1,a.im2,zST.join(","),a.child,0,preNode);a.id = newNode.id;preNode=null;}
 }
 else
 var newNode=this._attachChildNode(temp,a.id,a.text,0,a.im0,a.im1,a.im2,zST.join(","),a.child,(befNode||0),preNode);if (a.tooltip)newNode.span.parentNode.parentNode.title=a.tooltip;if (a.style)if (newNode.span.style.cssText)newNode.span.style.cssText+=(";"+a.style);else
 newNode.span.setAttribute("style",newNode.span.getAttribute("style")+";"+a.style);if (a.radio)newNode._r_logic=true;if (a.nocheckbox){var check_node=newNode.span.parentNode.previousSibling.previousSibling;check_node.childNodes[0].style.display='none';if (window._KHTMLrv)check_node.style.display="none";newNode.nocheckbox=true;}
 if (a.disabled){if (a.checked!=null)this._setCheck(newNode,a.checked);this.disableCheckbox(newNode,1);}
 
 newNode._acc=a.child||0;if (this.parserExtension)this.parserExtension._parseExtension.call(this,c,a,(temp?temp.id:0));this.setItemColor(newNode,a.aCol,a.sCol);if (a.locked=="1")this.lockItem(newNode.id,true,true);if ((a.imwidth)||(a.imheight)) this.setIconSize(a.imwidth,a.imheight,newNode);if ((a.closeable=="0")||(a.closeable=="1")) this.setItemCloseable(newNode,a.closeable);var zcall="";if (a.topoffset)this.setItemTopOffset(newNode,a.topoffset);if ((!this.slowParse)||(typeof(this.waitUpdateXML)=="object")){if (c.sub_exists("item"))
 zcall=this._parse(c,a.id,1);}
 if (zcall!="")this.nodeAskingCall=zcall;c.each("userdata",function(u){this.setUserData(c.get("id"),u.get("name"),u.content());},this)
 
 
 }
 dhtmlXTreeObject.prototype._parse=function(p,parentId,level,start){if (this._srnd && !this.parentObject.offsetHeight){var self=this;return window.setTimeout(function(){self._parse(p,parentId,level,start);},100);}
 if (!p.exists()) return;this.skipLock=true;if (!parentId){parentId=p.get("id");var skey = p.get("dhx_security");if (skey)dhtmlx.security_key = skey;if (p.get("radio"))
 this.htmlNode._r_logic=true;this.parsingOn=parentId;this.parsedArray=new Array();this.setCheckList="";this.nodeAskingCall="";}
 
 var temp=this._globalIdStorageFind(parentId);if (!temp)return dhtmlxError.throwError("DataStructure","XML refers to not existing parent");this.parsCount=this.parsCount?(this.parsCount+1):1;this.XMLloadingWarning=1;if ((temp.childsCount)&&(!start)&&(!this._edsbps)&&(!temp._has_top))
 var preNode=0;else
 var preNode=0;this.npl=0;p.each("item",function(c,i){temp.XMLload=1;this._parseItem(c,temp,0,preNode);this.npl++;},this,start);if (!level){p.each("userdata",function(u){this.setUserData(p.get("id"),u.get("name"),u.content());},this);temp.XMLload=1;if (this.waitUpdateXML){this.waitUpdateXML=false;for (var i=temp.childsCount-1;i>=0;i--)if (temp.childNodes[i]._dmark)this.deleteItem(temp.childNodes[i].id);}
 var parsedNodeTop=this._globalIdStorageFind(this.parsingOn);for (var i=0;i<this.parsedArray.length;i++)temp.htmlNode.childNodes[0].appendChild(this.parsedArray[i]);this.parsedArray = [];this.lastLoadedXMLId=parentId;this.XMLloadingWarning=0;var chArr=this.setCheckList.split(this.dlmtr);for (var n=0;n<chArr.length;n++)if (chArr[n])this.setCheck(chArr[n],1);if ((this.XMLsource)&&(this.tscheck)&&(this.smcheck)&&(temp.id!=this.rootId)){if (temp.checkstate===0)this._setSubChecked(0,temp);else if (temp.checkstate===1)this._setSubChecked(1,temp);}
 this._redrawFrom(this,null,start)
 if (p.get("order")&& p.get("order")!="none")
 this._reorderBranch(temp,p.get("order"),true);if (this.nodeAskingCall!="")this.callEvent("onClick",[this.nodeAskingCall,this.getSelectedItemId()]);if (this._branchUpdate)this._branchUpdateNext(p);}
 if (this.parsCount==1){this.parsingOn=null;if ((!this._edsbps)||(!this._edsbpsA.length)){var that=this;window.setTimeout( function(){that.callEvent("onXLE",[that,parentId]);},1);this.xmlstate=0;}
 this.skipLock=false;}
 this.parsCount--;if (!level && this.onXLE)this.onXLE(this,parentId);return this.nodeAskingCall;};dhtmlXTreeObject.prototype._branchUpdateNext=function(p){p.each("item",function(c){var nid=c.get("id");if (this._idpull[nid] && (!this._idpull[nid].XMLload)) return;this._branchUpdate++;this.smartRefreshItem(c.get("id"),c);},this)
 this._branchUpdate--;}

 dhtmlXTreeObject.prototype.checkUserData=function(node,parentId){if ((node.nodeType==1)&&(node.tagName == "userdata"))
 {var name=node.getAttribute("name");if ((name)&&(node.childNodes[0]))
 this.setUserData(parentId,name,node.childNodes[0].data);}
 }
 dhtmlXTreeObject.prototype._redrawFrom=function(dhtmlObject,itemObject,start,visMode){if (!itemObject){var tempx=dhtmlObject._globalIdStorageFind(dhtmlObject.lastLoadedXMLId);dhtmlObject.lastLoadedXMLId=-1;if (!tempx)return 0;}
 else tempx=itemObject;var acc=0;for (var i=(start?start-1:0);i<tempx.childsCount;i++)
 {if ((!this._branchUpdate)||(this._getOpenState(tempx)==1))
 if ((!itemObject)||(visMode==1)) tempx.childNodes[i].htmlNode.parentNode.parentNode.style.display="";if (tempx.childNodes[i].openMe==1){this._openItem(tempx.childNodes[i]);tempx.childNodes[i].openMe=0;}
 dhtmlObject._redrawFrom(dhtmlObject,tempx.childNodes[i]);};if ((!tempx.unParsed)&&((tempx.XMLload)||(!this.XMLsource)))
 tempx._acc=acc;dhtmlObject._correctLine(tempx);dhtmlObject._correctPlus(tempx);};dhtmlXTreeObject.prototype._createSelf=function(){var div=document.createElement('div');div.className="containerTableStyle";div.style.width=this.width;div.style.height=this.height;this.parentObject.appendChild(div);return div;};dhtmlXTreeObject.prototype._xcloseAll=function(itemObject)
 {if (itemObject.unParsed)return;if (this.rootId!=itemObject.id){if (!itemObject.htmlNode)return;var Nodes=itemObject.htmlNode.childNodes[0].childNodes;var Count=Nodes.length;for (var i=1;i<Count;i++)Nodes[i].style.display="none";this._correctPlus(itemObject);}
 for (var i=0;i<itemObject.childsCount;i++)if (itemObject.childNodes[i].childsCount)this._xcloseAll(itemObject.childNodes[i]);};dhtmlXTreeObject.prototype._xopenAll=function(itemObject)
 {this._HideShow(itemObject,2);for (var i=0;i<itemObject.childsCount;i++)this._xopenAll(itemObject.childNodes[i]);};dhtmlXTreeObject.prototype._correctPlus=function(itemObject){if (!itemObject.htmlNode)return;var imsrc=itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild;var imsrc2=itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0];var workArray=this.lineArray;if ((this.XMLsource)&&(!itemObject.XMLload))
 {var workArray=this.plusArray;this._setSrc(imsrc2,this.iconURL+itemObject.images[2]);if (this._txtimg)return (imsrc.innerHTML="[+]");}
 else
 if ((itemObject.childsCount)||(itemObject.unParsed))
 {if ((itemObject.htmlNode.childNodes[0].childNodes[1])&&( itemObject.htmlNode.childNodes[0].childNodes[1].style.display!="none" ))
 {if (!itemObject.wsign)var workArray=this.minusArray;this._setSrc(imsrc2,this.iconURL+itemObject.images[1]);if (this._txtimg)return (imsrc.innerHTML="[-]");}
 else
 {if (!itemObject.wsign)var workArray=this.plusArray;this._setSrc(imsrc2,this.iconURL+itemObject.images[2]);if (this._txtimg)return (imsrc.innerHTML="[+]");}
 }
 else
 {this._setSrc(imsrc2,this.iconURL+itemObject.images[0]);}
 var tempNum=2;if (!itemObject.treeNod.treeLinesOn)this._setSrc(imsrc,this.imPath+workArray[3]);else {if (itemObject.parentObject)tempNum=this._getCountStatus(itemObject.id,itemObject.parentObject);this._setSrc(imsrc,this.imPath+workArray[tempNum]);}
 };dhtmlXTreeObject.prototype._correctLine=function(itemObject){if (!itemObject.htmlNode)return;var sNode=itemObject.parentObject;if (sNode)if ((this._getLineStatus(itemObject.id,sNode)==0)||(!this.treeLinesOn))
 for(var i=1;i<=itemObject.childsCount;i++){if (!itemObject.htmlNode.childNodes[0].childNodes[i])break;itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundImage="";itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundRepeat="";}
 else
 for(var i=1;i<=itemObject.childsCount;i++){if (!itemObject.htmlNode.childNodes[0].childNodes[i])break;itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundImage="url("+this.imPath+this.lineArray[5]+")";itemObject.htmlNode.childNodes[0].childNodes[i].childNodes[0].style.backgroundRepeat="repeat-y";}
 };dhtmlXTreeObject.prototype._getCountStatus=function(itemId,itemObject){if (itemObject.childsCount<=1){if (itemObject.id==this.rootId)return 4;else return 0;}
 if (itemObject.childNodes[0].id==itemId)if (itemObject.id==this.rootId)return 2;else return 1;if (itemObject.childNodes[itemObject.childsCount-1].id==itemId)return 0;return 1;};dhtmlXTreeObject.prototype._getLineStatus =function(itemId,itemObject){if (itemObject.childNodes[itemObject.childsCount-1].id==itemId)return 0;return 1;}
 
 dhtmlXTreeObject.prototype._HideShow=function(itemObject,mode){if ((this.XMLsource)&&(!itemObject.XMLload)) {if (mode==1)return;itemObject.XMLload=1;this._loadDynXML(itemObject.id);return;};var Nodes=itemObject.htmlNode.childNodes[0].childNodes;var Count=Nodes.length;if (Count>1){if ( ( (Nodes[1].style.display!="none")|| (mode==1) ) && (mode!=2) ) {this.allTree.childNodes[0].border = "1";this.allTree.childNodes[0].border = "0";nodestyle="none";}
 else nodestyle="";for (var i=1;i<Count;i++)Nodes[i].style.display=nodestyle;}
 this._correctPlus(itemObject);}
 dhtmlXTreeObject.prototype._getOpenState=function(itemObject){if (!itemObject.htmlNode)return 0;var z=itemObject.htmlNode.childNodes[0].childNodes;if (z.length<=1)return 0;if (z[1].style.display!="none")return 1;else return -1;}
 

 
 dhtmlXTreeObject.prototype.onRowClick2=function(){var that=this.parentObject.treeNod;if (!that.callEvent("onDblClick",[this.parentObject.id,that])) return false;if ((this.parentObject.closeble)&&(this.parentObject.closeble!="0"))
 that._HideShow(this.parentObject);else
 that._HideShow(this.parentObject,2);if (that.checkEvent("onOpenEnd"))
 if (!that.xmlstate)that.callEvent("onOpenEnd",[this.parentObject.id,that._getOpenState(this.parentObject)]);else{that._oie_onXLE.push(that.onXLE);that.onXLE=that._epnFHe;}
 return false;};dhtmlXTreeObject.prototype.onRowClick=function(){var that=this.parentObject.treeNod;if (!that.callEvent("onOpenStart",[this.parentObject.id,that._getOpenState(this.parentObject)])) return 0;if ((this.parentObject.closeble)&&(this.parentObject.closeble!="0"))
 that._HideShow(this.parentObject);else
 that._HideShow(this.parentObject,2);if (that.checkEvent("onOpenEnd"))
 if (!that.xmlstate)that.callEvent("onOpenEnd",[this.parentObject.id,that._getOpenState(this.parentObject)]);else{that._oie_onXLE.push(that.onXLE);that.onXLE=that._epnFHe;}
 };dhtmlXTreeObject.prototype._epnFHe=function(that,id,flag){if (id!=this.rootId)this.callEvent("onOpenEnd",[id,that.getOpenState(id)]);that.onXLE=that._oie_onXLE.pop();if (!flag && !that._oie_onXLE.length)if (that.onXLE)that.onXLE(that,id);}
 dhtmlXTreeObject.prototype.onRowClickDown=function(e){e=e||window.event;var that=this.parentObject.treeNod;that._selectItem(this.parentObject,e);};dhtmlXTreeObject.prototype.getSelectedItemId=function()
 {var str=new Array();for (var i=0;i<this._selected.length;i++)str[i]=this._selected[i].id;return (str.join(this.dlmtr));};dhtmlXTreeObject.prototype._selectItem=function(node,e){if (this.checkEvent("onSelect")) this._onSSCFold=this.getSelectedItemId();this._unselectItems();this._markItem(node);if (this.checkEvent("onSelect")) {var z=this.getSelectedItemId();if (z!=this._onSSCFold)this.callEvent("onSelect",[z]);}
 }
 dhtmlXTreeObject.prototype._markItem=function(node){if (node.scolor)node.span.style.color=node.scolor;node.span.className="selectedTreeRow";node.i_sel=true;this._selected[this._selected.length]=node;}
 dhtmlXTreeObject.prototype.getIndexById=function(itemId){var z=this._globalIdStorageFind(itemId);if (!z)return null;return this._getIndex(z);};dhtmlXTreeObject.prototype._getIndex=function(w){var z=w.parentObject;for (var i=0;i<z.childsCount;i++)if (z.childNodes[i]==w)return i;};dhtmlXTreeObject.prototype._unselectItem=function(node){if ((node)&&(node.i_sel))
 {node.span.className="standartTreeRow";if (node.acolor)node.span.style.color=node.acolor;node.i_sel=false;for (var i=0;i<this._selected.length;i++)if (!this._selected[i].i_sel){this._selected.splice(i,1);break;}
 }
 }
 dhtmlXTreeObject.prototype._unselectItems=function(){for (var i=0;i<this._selected.length;i++){var node=this._selected[i];node.span.className="standartTreeRow";if (node.acolor)node.span.style.color=node.acolor;node.i_sel=false;}
 this._selected=new Array();}
 dhtmlXTreeObject.prototype.onRowSelect=function(e,htmlObject,mode){e=e||window.event;var obj=this.parentObject;if (htmlObject)obj=htmlObject.parentObject;var that=obj.treeNod;var lastId=that.getSelectedItemId();if ((!e)||(!e.skipUnSel))
 that._selectItem(obj,e);if (!mode){if (obj.actionHandler)obj.actionHandler(obj.id,lastId);else that.callEvent("onClick",[obj.id,lastId]);}
 };dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){if (!this.tscheck)return;if (!dhtmlObject)return;if (dhtmlObject.id==this.rootId)return;var act=dhtmlObject.childNodes;var flag1=0;var flag2=0;if (dhtmlObject.childsCount==0)return;for (var i=0;i<dhtmlObject.childsCount;i++){if (act[i].dscheck)continue;if (act[i].checkstate==0)flag1=1;else if (act[i].checkstate==1)flag2=1;else {flag1=1;flag2=1;break;}
 }
 if ((flag1)&&(flag2)) this._setCheck(dhtmlObject,"unsure");else if (flag1)this._setCheck(dhtmlObject,false);else this._setCheck(dhtmlObject,true);this._correctCheckStates(dhtmlObject.parentObject);}
 
 dhtmlXTreeObject.prototype.onCheckBoxClick=function(e){if (!this.treeNod.callEvent("onBeforeCheck",[this.parentObject.id,this.parentObject.checkstate]))
 return;if (this.parentObject.dscheck)return true;if (this.treeNod.tscheck)if (this.parentObject.checkstate==1)this.treeNod._setSubChecked(false,this.parentObject);else this.treeNod._setSubChecked(true,this.parentObject);else
 if (this.parentObject.checkstate==1)this.treeNod._setCheck(this.parentObject,false);else this.treeNod._setCheck(this.parentObject,true);this.treeNod._correctCheckStates(this.parentObject.parentObject);return this.treeNod.callEvent("onCheck",[this.parentObject.id,this.parentObject.checkstate]);};dhtmlXTreeObject.prototype._createItem=function(acheck,itemObject,mode){var table=document.createElement('table');table.cellSpacing=0;table.cellPadding=0;table.border=0;if(this.hfMode)table.style.tableLayout="fixed";table.style.margin=0;table.style.padding=0;var tbody=document.createElement('tbody');var tr=document.createElement('tr');var td1=document.createElement('td');td1.className="standartTreeImage";if(this._txtimg){var img0=document.createElement("div");td1.appendChild(img0);img0.className="dhx_tree_textSign";}
 else
 {var img0=this._getImg(itemObject.id);img0.border="0";if (img0.tagName=="IMG")img0.align="absmiddle";td1.appendChild(img0);img0.style.padding=0;img0.style.margin=0;img0.style.width=this.def_line_img_x;img0.style.height=this.def_line_img_y;}
 var td11=document.createElement('td');var inp=this._getImg(this.cBROf?this.rootId:itemObject.id);inp.checked=0;this._setSrc(inp,this.imPath+this.checkArray[0]);inp.style.width="16px";inp.style.height="16px";if (!acheck)((!_isIE)?td11:inp).style.display="none";td11.appendChild(inp);if ((!this.cBROf)&&(inp.tagName=="IMG")) inp.align="absmiddle";inp.onclick=this.onCheckBoxClick;inp.treeNod=this;inp.parentObject=itemObject;if (!window._KHTMLrv)td11.width="20px";else td11.width="16px";var td12=document.createElement('td');td12.className="standartTreeImage";var img=this._getImg(this.timgen?itemObject.id:this.rootId);img.onmousedown=this._preventNsDrag;img.ondragstart=this._preventNsDrag;img.border="0";if (this._aimgs){img.parentObject=itemObject;if (img.tagName=="IMG")img.align="absmiddle";img.onclick=this.onRowSelect;}
 if (!mode)this._setSrc(img,this.iconURL+this.imageArray[0]);td12.appendChild(img);img.style.padding=0;img.style.margin=0;if (this.timgen){td12.style.width=img.style.width=this.def_img_x;img.style.height=this.def_img_y;}
 else
 {img.style.width="0px";img.style.height="0px";if (_isOpera || window._KHTMLrv )td12.style.display="none";}
 var td2=document.createElement('td');td2.className="standartTreeRow";itemObject.span=document.createElement('span');itemObject.span.className="standartTreeRow";if (this.mlitems){itemObject.span.style.width=this.mlitems;itemObject.span.style.display="block";}
 else td2.noWrap=true;if (_isIE && _isIE>7)td2.style.width="999999px";else if (!window._KHTMLrv)td2.style.width="100%";itemObject.span.innerHTML=itemObject.label;td2.appendChild(itemObject.span);td2.parentObject=itemObject;td1.parentObject=itemObject;td2.onclick=this.onRowSelect;td1.onclick=this.onRowClick;td2.ondblclick=this.onRowClick2;if (this.ettip)tr.title=itemObject.label;if (this.dragAndDropOff){if (this._aimgs){this.dragger.addDraggableItem(td12,this);td12.parentObject=itemObject;}
 this.dragger.addDraggableItem(td2,this);}
 itemObject.span.style.paddingLeft="5px";itemObject.span.style.paddingRight="5px";td2.style.verticalAlign="";td2.style.fontSize="10pt";td2.style.cursor=this.style_pointer;tr.appendChild(td1);tr.appendChild(td11);tr.appendChild(td12);tr.appendChild(td2);tbody.appendChild(tr);table.appendChild(tbody);if (this.ehlt || this.checkEvent("onMouseIn")|| this.checkEvent("onMouseOut")){tr.onmousemove=this._itemMouseIn;tr[(_isIE)?"onmouseleave":"onmouseout"]=this._itemMouseOut;}
 return table;};dhtmlXTreeObject.prototype.setImagePath=function( newPath ){this.imPath=newPath;this.iconURL=newPath;};dhtmlXTreeObject.prototype.setIconPath=function(path){this.iconURL=path;}




 dhtmlXTreeObject.prototype.setOnRightClickHandler=function(func){this.attachEvent("onRightClick",func);};dhtmlXTreeObject.prototype.setOnClickHandler=function(func){this.attachEvent("onClick",func);};dhtmlXTreeObject.prototype.setOnSelectStateChange=function(func){this.attachEvent("onSelect",func);};dhtmlXTreeObject.prototype.setXMLAutoLoading=function(filePath){this.XMLsource=filePath;};dhtmlXTreeObject.prototype.setOnCheckHandler=function(func){this.attachEvent("onCheck",func);};dhtmlXTreeObject.prototype.setOnOpenHandler=function(func){this.attachEvent("onOpenStart",func);};dhtmlXTreeObject.prototype.setOnOpenStartHandler=function(func){this.attachEvent("onOpenStart",func);};dhtmlXTreeObject.prototype.setOnOpenEndHandler=function(func){this.attachEvent("onOpenEnd",func);};dhtmlXTreeObject.prototype.setOnDblClickHandler=function(func){this.attachEvent("onDblClick",func);};dhtmlXTreeObject.prototype.openAllItems=function(itemId)
 {var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;this._xopenAll(temp);};dhtmlXTreeObject.prototype.getOpenState=function(itemId){var temp=this._globalIdStorageFind(itemId);if (!temp)return "";return this._getOpenState(temp);};dhtmlXTreeObject.prototype.closeAllItems=function(itemId)
 {if (itemId===window.undefined)itemId=this.rootId;var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;this._xcloseAll(temp);this.allTree.childNodes[0].border = "1";this.allTree.childNodes[0].border = "0";};dhtmlXTreeObject.prototype.setUserData=function(itemId,name,value){var sNode=this._globalIdStorageFind(itemId,0,true);if (!sNode)return;if(name=="hint")sNode.htmlNode.childNodes[0].childNodes[0].title=value;if (typeof(sNode.userData["t_"+name])=="undefined"){if (!sNode._userdatalist)sNode._userdatalist=name;else sNode._userdatalist+=","+name;}
 sNode.userData["t_"+name]=value;};dhtmlXTreeObject.prototype.getUserData=function(itemId,name){var sNode=this._globalIdStorageFind(itemId,0,true);if (!sNode)return;return sNode.userData["t_"+name];};dhtmlXTreeObject.prototype.getItemColor=function(itemId)
 {var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;var res= new Object();if (temp.acolor)res.acolor=temp.acolor;if (temp.scolor)res.scolor=temp.scolor;return res;};dhtmlXTreeObject.prototype.setItemColor=function(itemId,defaultColor,selectedColor)
 {if ((itemId)&&(itemId.span))
 var temp=itemId;else
 var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;else {if (temp.i_sel){if (selectedColor)temp.span.style.color=selectedColor;}
 else
 {if (defaultColor)temp.span.style.color=defaultColor;}
 if (selectedColor)temp.scolor=selectedColor;if (defaultColor)temp.acolor=defaultColor;}
 };dhtmlXTreeObject.prototype.getItemText=function(itemId)
 {var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;return(temp.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML);};dhtmlXTreeObject.prototype.getParentId=function(itemId)
 {var temp=this._globalIdStorageFind(itemId);if ((!temp)||(!temp.parentObject)) return "";return temp.parentObject.id;};dhtmlXTreeObject.prototype.changeItemId=function(itemId,newItemId)
 {if (itemId==newItemId)return;var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;temp.id=newItemId;temp.span.contextMenuId=newItemId;this._idpull[newItemId]=this._idpull[itemId];delete this._idpull[itemId];};dhtmlXTreeObject.prototype.doCut=function(){if (this.nodeCut)this.clearCut();this.nodeCut=(new Array()).concat(this._selected);for (var i=0;i<this.nodeCut.length;i++){var tempa=this.nodeCut[i];tempa._cimgs=new Array();tempa._cimgs[0]=tempa.images[0];tempa._cimgs[1]=tempa.images[1];tempa._cimgs[2]=tempa.images[2];tempa.images[0]=tempa.images[1]=tempa.images[2]=this.cutImage;this._correctPlus(tempa);}
 };dhtmlXTreeObject.prototype.doPaste=function(itemId){var tobj=this._globalIdStorageFind(itemId);if (!tobj)return 0;for (var i=0;i<this.nodeCut.length;i++){if (this._checkPNodes(tobj,this.nodeCut[i])) continue;this._moveNode(this.nodeCut[i],tobj);}
 this.clearCut();};dhtmlXTreeObject.prototype.clearCut=function(){for (var i=0;i<this.nodeCut.length;i++){var tempa=this.nodeCut[i];tempa.images[0]=tempa._cimgs[0];tempa.images[1]=tempa._cimgs[1];tempa.images[2]=tempa._cimgs[2];this._correctPlus(tempa);}
 this.nodeCut=new Array();};dhtmlXTreeObject.prototype._moveNode=function(itemObject,targetObject){return this._moveNodeTo(itemObject,targetObject);}
 

dhtmlXTreeObject.prototype._fixNodesCollection=function(target,zParent){var flag=0;var icount=0;var Nodes=target.childNodes;var Count=target.childsCount-1;if (zParent==Nodes[Count])return;for (var i=0;i<Count;i++)if (Nodes[i]==Nodes[Count]){Nodes[i]=Nodes[i+1];Nodes[i+1]=Nodes[Count];}
 for (var i=0;i<Count+1;i++){if (flag){var temp=Nodes[i];Nodes[i]=flag;flag=temp;}
 else 
 if (Nodes[i]==zParent){flag=Nodes[i];Nodes[i]=Nodes[Count];}
 }
 };dhtmlXTreeObject.prototype._recreateBranch=function(itemObject,targetObject,beforeNode,level){var i;var st="";if (beforeNode){for (i=0;i<targetObject.childsCount;i++)if (targetObject.childNodes[i]==beforeNode)break;if (i!=0)beforeNode=targetObject.childNodes[i-1];else{st="TOP";beforeNode="";}
 }
 var t2=this._onradh;this._onradh=null;var newNode=this._attachChildNode(targetObject,itemObject.id,itemObject.label,0,itemObject.images[0],itemObject.images[1],itemObject.images[2],st,0,beforeNode);newNode._userdatalist=itemObject._userdatalist;newNode.userData=itemObject.userData.clone();if(itemObject._attrs){newNode._attrs={};for(var attr in itemObject._attrs)newNode._attrs[attr] = itemObject._attrs[attr];}
 newNode.XMLload=itemObject.XMLload;if (t2){this._onradh=t2;this._onradh(newNode.id);}
 for (var i=0;i<itemObject.childsCount;i++)this._recreateBranch(itemObject.childNodes[i],newNode,0,1);return newNode;}
 dhtmlXTreeObject.prototype._moveNodeTo=function(itemObject,targetObject,beforeNode){if (itemObject.treeNod._nonTrivialNode)return itemObject.treeNod._nonTrivialNode(this,targetObject,beforeNode,itemObject);if (this._checkPNodes(targetObject,itemObject))
 return false;if (targetObject.mytype)var framesMove=(itemObject.treeNod.lWin!=targetObject.lWin);else
 var framesMove=(itemObject.treeNod.lWin!=targetObject.treeNod.lWin);if (!this.callEvent("onDrag",[itemObject.id,targetObject.id,(beforeNode?beforeNode.id:null),itemObject.treeNod,targetObject.treeNod])) return false;if ((targetObject.XMLload==0)&&(this.XMLsource))
 {targetObject.XMLload=1;this._loadDynXML(targetObject.id);}
 this.openItem(targetObject.id);var oldTree=itemObject.treeNod;var c=itemObject.parentObject.childsCount;var z=itemObject.parentObject;if ((framesMove)||(oldTree.dpcpy)) {var _otiid=itemObject.id;itemObject=this._recreateBranch(itemObject,targetObject,beforeNode);if (!oldTree.dpcpy)oldTree.deleteItem(_otiid);}
 else
 {var Count=targetObject.childsCount;var Nodes=targetObject.childNodes;if (Count==0)targetObject._open=true;oldTree._unselectItem(itemObject);Nodes[Count]=itemObject;itemObject.treeNod=targetObject.treeNod;targetObject.childsCount++;var tr=this._drawNewTr(Nodes[Count].htmlNode);if (!beforeNode){targetObject.htmlNode.childNodes[0].appendChild(tr);if (this.dadmode==1)this._fixNodesCollection(targetObject,beforeNode);}
 else
 {targetObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr);this._fixNodesCollection(targetObject,beforeNode);Nodes=targetObject.childNodes;}
 
 }
 if ((!oldTree.dpcpy)&&(!framesMove)) {var zir=itemObject.tr;if ((document.all)&&(navigator.appVersion.search(/MSIE\ 5\.0/gi)!=-1))
 {window.setTimeout(function() {zir.parentNode.removeChild(zir);}, 250 );}
 else 

 itemObject.parentObject.htmlNode.childNodes[0].removeChild(itemObject.tr);if ((!beforeNode)||(targetObject!=itemObject.parentObject)){for (var i=0;i<z.childsCount;i++){if (z.childNodes[i].id==itemObject.id){z.childNodes[i]=0;break;}}}
 else z.childNodes[z.childsCount-1]=0;oldTree._compressChildList(z.childsCount,z.childNodes);z.childsCount--;}
 if ((!framesMove)&&(!oldTree.dpcpy)) {itemObject.tr=tr;tr.nodem=itemObject;itemObject.parentObject=targetObject;if (oldTree!=targetObject.treeNod){if(itemObject.treeNod._registerBranch(itemObject,oldTree)) return;this._clearStyles(itemObject);this._redrawFrom(this,itemObject.parentObject);if(this._onradh)this._onradh(itemObject.id);};this._correctPlus(targetObject);this._correctLine(targetObject);this._correctLine(itemObject);this._correctPlus(itemObject);if (beforeNode){this._correctPlus(beforeNode);}
 else 
 if (targetObject.childsCount>=2){this._correctPlus(Nodes[targetObject.childsCount-2]);this._correctLine(Nodes[targetObject.childsCount-2]);}
 
 this._correctPlus(Nodes[targetObject.childsCount-1]);if (this.tscheck)this._correctCheckStates(targetObject);if (oldTree.tscheck)oldTree._correctCheckStates(z);}
 

 if (c>1){oldTree._correctPlus(z.childNodes[c-2]);oldTree._correctLine(z.childNodes[c-2]);}
 oldTree._correctPlus(z);oldTree._correctLine(z);this.callEvent("onDrop",[itemObject.id,targetObject.id,(beforeNode?beforeNode.id:null),oldTree,targetObject.treeNod]);return itemObject.id;};dhtmlXTreeObject.prototype._clearStyles=function(itemObject){if (!itemObject.htmlNode)return;var td1=itemObject.htmlNode.childNodes[0].childNodes[0].childNodes[1];var td3=td1.nextSibling.nextSibling;itemObject.span.innerHTML=itemObject.label;itemObject.i_sel=false;if (itemObject._aimgs)this.dragger.removeDraggableItem(td1.nextSibling);if (this.checkBoxOff){td1.childNodes[0].style.display="";td1.childNodes[0].onclick=this.onCheckBoxClick;this._setSrc(td1.childNodes[0],this.imPath+this.checkArray[itemObject.checkstate]);}
 else td1.childNodes[0].style.display="none";td1.childNodes[0].treeNod=this;this.dragger.removeDraggableItem(td3);if (this.dragAndDropOff)this.dragger.addDraggableItem(td3,this);if (this._aimgs)this.dragger.addDraggableItem(td1.nextSibling,this);td3.childNodes[0].className="standartTreeRow";td3.onclick=this.onRowSelect;td3.ondblclick=this.onRowClick2;td1.previousSibling.onclick=this.onRowClick;this._correctLine(itemObject);this._correctPlus(itemObject);for (var i=0;i<itemObject.childsCount;i++)this._clearStyles(itemObject.childNodes[i]);};dhtmlXTreeObject.prototype._registerBranch=function(itemObject,oldTree){if (oldTree)oldTree._globalIdStorageSub(itemObject.id);itemObject.id=this._globalIdStorageAdd(itemObject.id,itemObject);itemObject.treeNod=this;for (var i=0;i<itemObject.childsCount;i++)this._registerBranch(itemObject.childNodes[i],oldTree);return 0;};dhtmlXTreeObject.prototype.enableThreeStateCheckboxes=function(mode) {this.tscheck=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.setOnMouseInHandler=function(func){this.ehlt=true;this.attachEvent("onMouseIn",func);};dhtmlXTreeObject.prototype.setOnMouseOutHandler=function(func){this.ehlt=true;this.attachEvent("onMouseOut",func);};dhtmlXTreeObject.prototype.enableTreeImages=function(mode) {this.timgen=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.enableFixedMode=function(mode) {this.hfMode=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.enableCheckBoxes=function(mode, hidden){this.checkBoxOff=convertStringToBoolean(mode);this.cBROf=(!(this.checkBoxOff||convertStringToBoolean(hidden)));};dhtmlXTreeObject.prototype.setStdImages=function(image1,image2,image3){this.imageArray[0]=image1;this.imageArray[1]=image2;this.imageArray[2]=image3;};dhtmlXTreeObject.prototype.enableTreeLines=function(mode){this.treeLinesOn=convertStringToBoolean(mode);}
 
 dhtmlXTreeObject.prototype.setImageArrays=function(arrayName,image1,image2,image3,image4,image5){switch(arrayName){case "plus": this.plusArray[0]=image1;this.plusArray[1]=image2;this.plusArray[2]=image3;this.plusArray[3]=image4;this.plusArray[4]=image5;break;case "minus": this.minusArray[0]=image1;this.minusArray[1]=image2;this.minusArray[2]=image3;this.minusArray[3]=image4;this.minusArray[4]=image5;break;}
 };dhtmlXTreeObject.prototype.openItem=function(itemId){var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;else return this._openItem(temp);};dhtmlXTreeObject.prototype._openItem=function(item){var state=this._getOpenState(item);if ((state<0)||(((this.XMLsource)&&(!item.XMLload)))){if (!this.callEvent("onOpenStart",[item.id,state])) return 0;this._HideShow(item,2);if (this.checkEvent("onOpenEnd")){if (this.onXLE==this._epnFHe)this._epnFHe(this,item.id,true);if (!this.xmlstate || !this.XMLsource)this.callEvent("onOpenEnd",[item.id,this._getOpenState(item)]);else{this._oie_onXLE.push(this.onXLE);this.onXLE=this._epnFHe;}
 }
 }else if (this._srnd)this._HideShow(item,2);if (item.parentObject && !this._skip_open_parent)this._openItem(item.parentObject);};dhtmlXTreeObject.prototype.closeItem=function(itemId){if (this.rootId==itemId)return 0;var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;if (temp.closeble)this._HideShow(temp,1);};dhtmlXTreeObject.prototype.getLevel=function(itemId){var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;return this._getNodeLevel(temp,0);};dhtmlXTreeObject.prototype.setItemCloseable=function(itemId,flag)
 {flag=convertStringToBoolean(flag);if ((itemId)&&(itemId.span)) 
 var temp=itemId;else 
 var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;temp.closeble=flag;};dhtmlXTreeObject.prototype._getNodeLevel=function(itemObject,count){if (itemObject.parentObject)return this._getNodeLevel(itemObject.parentObject,count+1);return(count);};dhtmlXTreeObject.prototype.hasChildren=function(itemId){var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;else 
 {if ( (this.XMLsource)&&(!temp.XMLload) ) return true;else 
 return temp.childsCount;};};dhtmlXTreeObject.prototype._getLeafCount=function(itemNode){var a=0;for (var b=0;b<itemNode.childsCount;b++)if (itemNode.childNodes[b].childsCount==0)a++;return a;}
 

 dhtmlXTreeObject.prototype.setItemText=function(itemId,newLabel,newTooltip)
 {var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;temp.label=newLabel;temp.span.innerHTML=newLabel;temp.span.parentNode.parentNode.title=newTooltip||"";};dhtmlXTreeObject.prototype.getItemTooltip=function(itemId){var temp=this._globalIdStorageFind(itemId);if (!temp)return "";return (temp.span.parentNode.parentNode._dhx_title||temp.span.parentNode.parentNode.title||"");};dhtmlXTreeObject.prototype.refreshItem=function(itemId){if (!itemId)itemId=this.rootId;var temp=this._globalIdStorageFind(itemId);this.deleteChildItems(itemId);this._loadDynXML(itemId);};dhtmlXTreeObject.prototype.setItemImage2=function(itemId, image1,image2,image3){var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;temp.images[1]=image2;temp.images[2]=image3;temp.images[0]=image1;this._correctPlus(temp);};dhtmlXTreeObject.prototype.setItemImage=function(itemId,image1,image2)
 {var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;if (image2){temp.images[1]=image1;temp.images[2]=image2;}
 else temp.images[0]=image1;this._correctPlus(temp);};dhtmlXTreeObject.prototype.getSubItems =function(itemId)
 {var temp=this._globalIdStorageFind(itemId,0,1);if (!temp)return 0;var z="";for (i=0;i<temp.childsCount;i++){if (!z)z=temp.childNodes[i].id;else z+=this.dlmtr+temp.childNodes[i].id;}
 return z;};dhtmlXTreeObject.prototype._getAllScraggyItems =function(node)
 {var z="";for (var i=0;i<node.childsCount;i++){if ((node.childNodes[i].unParsed)||(node.childNodes[i].childsCount>0))
 {if (node.childNodes[i].unParsed)var zb=this._getAllScraggyItemsXML(node.childNodes[i].unParsed,1);else
 var zb=this._getAllScraggyItems(node.childNodes[i])

 if (zb)if (z)z+=this.dlmtr+zb;else z=zb;}
 else
 if (!z)z=node.childNodes[i].id;else z+=this.dlmtr+node.childNodes[i].id;}
 return z;};dhtmlXTreeObject.prototype._getAllFatItems =function(node)
 {var z="";for (var i=0;i<node.childsCount;i++){if ((node.childNodes[i].unParsed)||(node.childNodes[i].childsCount>0))
 {if (!z)z=node.childNodes[i].id;else z+=this.dlmtr+node.childNodes[i].id;if (node.childNodes[i].unParsed)var zb=this._getAllFatItemsXML(node.childNodes[i].unParsed,1);else
 var zb=this._getAllFatItems(node.childNodes[i])

 if (zb)z+=this.dlmtr+zb;}
 }
 return z;};dhtmlXTreeObject.prototype._getAllSubItems =function(itemId,z,node)
 {if (node)temp=node;else {var temp=this._globalIdStorageFind(itemId);};if (!temp)return 0;z="";for (var i=0;i<temp.childsCount;i++){if (!z)z=temp.childNodes[i].id;else z+=this.dlmtr+temp.childNodes[i].id;var zb=this._getAllSubItems(0,z,temp.childNodes[i])

 if (zb)z+=this.dlmtr+zb;}
 return z;};dhtmlXTreeObject.prototype.selectItem=function(itemId,mode,preserve){mode=convertStringToBoolean(mode);var temp=this._globalIdStorageFind(itemId);if ((!temp)||(!temp.parentObject)) return 0;if (this.XMLloadingWarning)temp.parentObject.openMe=1;else
 this._openItem(temp.parentObject);var ze=null;if (preserve){ze=new Object;ze.ctrlKey=true;if (temp.i_sel)ze.skipUnSel=true;}
 if (mode)this.onRowSelect(ze,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],false);else
 this.onRowSelect(ze,temp.htmlNode.childNodes[0].childNodes[0].childNodes[3],true);};dhtmlXTreeObject.prototype.getSelectedItemText=function()
 {var str=new Array();for (var i=0;i<this._selected.length;i++)str[i]=this._selected[i].span.innerHTML;return (str.join(this.dlmtr));};dhtmlXTreeObject.prototype._compressChildList=function(Count,Nodes)
 {Count--;for (var i=0;i<Count;i++){if (Nodes[i]==0){Nodes[i]=Nodes[i+1];Nodes[i+1]=0;}
 };};dhtmlXTreeObject.prototype._deleteNode=function(itemId,htmlObject,skip){if ((!htmlObject)||(!htmlObject.parentObject)) return 0;var tempos=0;var tempos2=0;if (htmlObject.tr.nextSibling)tempos=htmlObject.tr.nextSibling.nodem;if (htmlObject.tr.previousSibling)tempos2=htmlObject.tr.previousSibling.nodem;var sN=htmlObject.parentObject;var Count=sN.childsCount;var Nodes=sN.childNodes;for (var i=0;i<Count;i++){if (Nodes[i].id==itemId){if (!skip)sN.htmlNode.childNodes[0].removeChild(Nodes[i].tr);Nodes[i]=0;break;}
 }
 this._compressChildList(Count,Nodes);if (!skip){sN.childsCount--;}
 if (tempos){this._correctPlus(tempos);this._correctLine(tempos);}
 if (tempos2){this._correctPlus(tempos2);this._correctLine(tempos2);}
 if (this.tscheck)this._correctCheckStates(sN);if (!skip){this._globalIdStorageRecSub(htmlObject);}
 };dhtmlXTreeObject.prototype.setCheck=function(itemId,state){var sNode=this._globalIdStorageFind(itemId,0,1);if (!sNode)return;if (state==="unsure")this._setCheck(sNode,state);else
 {state=convertStringToBoolean(state);if ((this.tscheck)&&(this.smcheck)) this._setSubChecked(state,sNode);else this._setCheck(sNode,state);}
 if (this.smcheck)this._correctCheckStates(sNode.parentObject);};dhtmlXTreeObject.prototype._setCheck=function(sNode,state){if (!sNode)return;if (((sNode.parentObject._r_logic)||(this._frbtr))&&(state))
 if (this._frbtrs){if (this._frbtrL)this.setCheck(this._frbtrL.id,0);this._frbtrL=sNode;}else
 for (var i=0;i<sNode.parentObject.childsCount;i++)this._setCheck(sNode.parentObject.childNodes[i],0);var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];if (state=="unsure")sNode.checkstate=2;else if (state)sNode.checkstate=1;else sNode.checkstate=0;if (sNode.dscheck)sNode.checkstate=sNode.dscheck;this._setSrc(z,this.imPath+((sNode.parentObject._r_logic||this._frbtr)?this.radioArray:this.checkArray)[sNode.checkstate]);};dhtmlXTreeObject.prototype.setSubChecked=function(itemId,state){var sNode=this._globalIdStorageFind(itemId);this._setSubChecked(state,sNode);this._correctCheckStates(sNode.parentObject);}
 dhtmlXTreeObject.prototype._setSubChecked=function(state,sNode){state=convertStringToBoolean(state);if (!sNode)return;if (((sNode.parentObject._r_logic)||(this._frbtr))&&(state))
 for (var i=0;i<sNode.parentObject.childsCount;i++)this._setSubChecked(0,sNode.parentObject.childNodes[i]);if (sNode._r_logic||this._frbtr)this._setSubChecked(state,sNode.childNodes[0]);else
 for (var i=0;i<sNode.childsCount;i++){this._setSubChecked(state,sNode.childNodes[i]);};var z=sNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];if (state)sNode.checkstate=1;else sNode.checkstate=0;if (sNode.dscheck)sNode.checkstate=sNode.dscheck;this._setSrc(z,this.imPath+((sNode.parentObject._r_logic||this._frbtr)?this.radioArray:this.checkArray)[sNode.checkstate]);};dhtmlXTreeObject.prototype.isItemChecked=function(itemId){var sNode=this._globalIdStorageFind(itemId);if (!sNode)return;return sNode.checkstate;};dhtmlXTreeObject.prototype.deleteChildItems=function(itemId)
 {var sNode=this._globalIdStorageFind(itemId);if (!sNode)return;var j=sNode.childsCount;for (var i=0;i<j;i++){this._deleteNode(sNode.childNodes[0].id,sNode.childNodes[0]);};};dhtmlXTreeObject.prototype.deleteItem=function(itemId,selectParent){if ((!this._onrdlh)||(this._onrdlh(itemId))){var z=this._deleteItem(itemId,selectParent);}
 
 this.allTree.childNodes[0].border = "1";this.allTree.childNodes[0].border = "0";}
dhtmlXTreeObject.prototype._deleteItem=function(itemId,selectParent,skip){selectParent=convertStringToBoolean(selectParent);var sNode=this._globalIdStorageFind(itemId);if (!sNode)return;var pid=this.getParentId(itemId);var zTemp=sNode.parentObject;this._deleteNode(itemId,sNode,skip);if(this._editCell&&this._editCell.id==itemId)this._editCell = null;this._correctPlus(zTemp);this._correctLine(zTemp);if ((selectParent)&&(pid!=this.rootId)) this.selectItem(pid,1);return zTemp;};dhtmlXTreeObject.prototype._globalIdStorageRecSub=function(itemObject){for(var i=0;i<itemObject.childsCount;i++){this._globalIdStorageRecSub(itemObject.childNodes[i]);this._globalIdStorageSub(itemObject.childNodes[i].id);};this._globalIdStorageSub(itemObject.id);var z=itemObject;z.span=null;z.tr.nodem=null;z.tr=null;z.htmlNode=null;};dhtmlXTreeObject.prototype.insertNewNext=function(itemId,newItemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children){var sNode=this._globalIdStorageFind(itemId);if ((!sNode)||(!sNode.parentObject)) return (0);var nodez=this._attachChildNode(0,newItemId,itemText,itemActionHandler,image1,image2,image3,optionStr,children,sNode);return nodez;};dhtmlXTreeObject.prototype.getItemIdByIndex=function(itemId,index){var z=this._globalIdStorageFind(itemId);if ((!z)||(index>=z.childsCount)) return null;return z.childNodes[index].id;};dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(itemId,index){var z=this._globalIdStorageFind(itemId);if ((!z)||(index>=z.childsCount)) return null;return z.childNodes[index].id;};dhtmlXTreeObject.prototype.setDragHandler=function(func){this.attachEvent("onDrag",func);};dhtmlXTreeObject.prototype._clearMove=function(){if (this._lastMark){this._lastMark.className=this._lastMark.className.replace(/dragAndDropRow/g,"");this._lastMark=null;}
 this.allTree.className=this.allTree.className.replace(" selectionBox","");};dhtmlXTreeObject.prototype.enableDragAndDrop=function(mode,rmode){if (mode=="temporary_disabled"){this.dADTempOff=false;mode=true;}
 else
 this.dADTempOff=true;this.dragAndDropOff=convertStringToBoolean(mode);if (this.dragAndDropOff)this.dragger.addDragLanding(this.allTree,this);if (arguments.length>1)this._ddronr=(!convertStringToBoolean(rmode));};dhtmlXTreeObject.prototype._setMove=function(htmlNode,x,y){if (htmlNode.parentObject.span){var a1=getAbsoluteTop(htmlNode);var a2=getAbsoluteTop(this.allTree)-this.allTree.scrollTop;this.dadmodec=this.dadmode;this.dadmodefix=0;var zN=htmlNode.parentObject.span;zN.className+=" dragAndDropRow";this._lastMark=zN;this._autoScroll(null,a1,a2);}
 };dhtmlXTreeObject.prototype._autoScroll=function(node,a1,a2){if (this.autoScroll){if (node){a1=getAbsoluteTop(node);a2=getAbsoluteTop(this.allTree)-this.allTree.scrollTop;}
 
 if ( (a1-a2-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50) )
 this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20;if ( (a1-a2)<(parseInt(this.allTree.scrollTop)+30) )
 this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20;}
}
dhtmlXTreeObject.prototype._createDragNode=function(htmlObject,e){if (!this.dADTempOff)return null;var obj=htmlObject.parentObject;if (!this.callEvent("onBeforeDrag",[obj.id, e])) return null;if (!obj.i_sel){this._selectItem(obj,e);}
 var dragSpan=document.createElement('div');var text=new Array();if (this._itim_dg)for (var i=0;i<this._selected.length;i++)text[i]="<table cellspacing='0' cellpadding='0'><tr><td><img width='18px' height='18px' src='"+this._getSrc(this._selected[i].span.parentNode.previousSibling.childNodes[0])+"'></td><td>"+this._selected[i].span.innerHTML+"</td></tr></table>";else
 text=this.getSelectedItemText().split(this.dlmtr);dragSpan.innerHTML=text.join("");dragSpan.style.position="absolute";dragSpan.className="dragSpanDiv";this._dragged=(new Array()).concat(this._selected);return dragSpan;}
dhtmlXTreeObject.prototype._focusNode=function(item){var z=getAbsoluteTop(item.htmlNode)-getAbsoluteTop(this.allTree);if ((z>(this.allTree.offsetHeight-30)) || (z<0))
 this.allTree.scrollTop=z+this.allTree.scrollTop;};dhtmlXTreeObject.prototype._preventNsDrag=function(e){if ((e)&&(e.preventDefault)) {e.preventDefault();return false;}
 return false;}
dhtmlXTreeObject.prototype._drag=function(sourceHtmlObject,dhtmlObject,targetHtmlObject){if (this._autoOpenTimer)clearTimeout(this._autoOpenTimer);if (!targetHtmlObject.parentObject){targetHtmlObject=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];this.dadmodec=0;}
 this._clearMove();var z=sourceHtmlObject.parentObject.treeNod;if ((z)&&(z._clearMove)) z._clearMove("");if ((!this.dragMove)||(this.dragMove()))
 {if ((!z)||(!z._clearMove)||(!z._dragged)) var col=new Array(sourceHtmlObject.parentObject);else var col=z._dragged;var trg=targetHtmlObject.parentObject;for (var i=0;i<col.length;i++){var newID=this._moveNode(col[i],trg);if ((this.dadmodec)&&(newID!==false)) trg=this._globalIdStorageFind(newID,true,true);if ((newID)&&(!this._sADnD)) this.selectItem(newID,0,1);}
 }
 if (z)z._dragged=new Array();}
dhtmlXTreeObject.prototype._dragIn=function(htmlObject,shtmlObject,x,y){if (!this.dADTempOff)return 0;var fobj=shtmlObject.parentObject;var tobj=htmlObject.parentObject;if ((!tobj)&&(this._ddronr)) return;if (!this.callEvent("onDragIn",[fobj.id,tobj?tobj.id:null,fobj.treeNod,this])){if (tobj)this._autoScroll(htmlObject);return 0;}
 

 if (!tobj)this.allTree.className+=" selectionBox";else
 {if (fobj.childNodes==null){this._setMove(htmlObject,x,y);return htmlObject;}
 var stree=fobj.treeNod;for (var i=0;i<stree._dragged.length;i++)if (this._checkPNodes(tobj,stree._dragged[i])){this._autoScroll(htmlObject);return 0;}
 this._setMove(htmlObject,x,y);if (this._getOpenState(tobj)<=0){this._autoOpenId=tobj.id;this._autoOpenTimer=window.setTimeout(new callerFunction(this._autoOpenItem,this),1000);}
 }
 
 return htmlObject;}
dhtmlXTreeObject.prototype._autoOpenItem=function(e,treeObject){treeObject.openItem(treeObject._autoOpenId);};dhtmlXTreeObject.prototype._dragOut=function(htmlObject){this._clearMove();if (this._autoOpenTimer)clearTimeout(this._autoOpenTimer);}
dhtmlXTreeObject.prototype.moveItem=function(itemId,mode,targetId,targetTree)
{var sNode=this._globalIdStorageFind(itemId);if (!sNode)return (0);switch(mode){case "right": alert('Not supported yet');break;case "item_child":
 var tNode=(targetTree||this)._globalIdStorageFind(targetId);if (!tNode)return (0);(targetTree||this)._moveNodeTo(sNode,tNode,0);break;case "item_sibling":
 var tNode=(targetTree||this)._globalIdStorageFind(targetId);if (!tNode)return (0);(targetTree||this)._moveNodeTo(sNode,tNode.parentObject,tNode);break;case "item_sibling_next":
 var tNode=(targetTree||this)._globalIdStorageFind(targetId);if (!tNode)return (0);if ((tNode.tr)&&(tNode.tr.nextSibling)&&(tNode.tr.nextSibling.nodem))
 (targetTree||this)._moveNodeTo(sNode,tNode.parentObject,tNode.tr.nextSibling.nodem);else
 (targetTree||this)._moveNodeTo(sNode,tNode.parentObject);break;case "left": if (sNode.parentObject.parentObject)this._moveNodeTo(sNode,sNode.parentObject.parentObject,sNode.parentObject);break;case "up": var z=this._getPrevNode(sNode);if ((z==-1)||(!z.parentObject)) return;this._moveNodeTo(sNode,z.parentObject,z);break;case "up_strict": var z=this._getIndex(sNode);if (z!=0)this._moveNodeTo(sNode,sNode.parentObject,sNode.parentObject.childNodes[z-1]);break;case "down_strict": var z=this._getIndex(sNode);var count=sNode.parentObject.childsCount-2;if (z==count)this._moveNodeTo(sNode,sNode.parentObject);else if (z<count)this._moveNodeTo(sNode,sNode.parentObject,sNode.parentObject.childNodes[z+2]);break;case "down": var z=this._getNextNode(this._lastChild(sNode));if ((z==-1)||(!z.parentObject)) return;if (z.parentObject==sNode.parentObject)var z=this._getNextNode(z);if (z==-1){this._moveNodeTo(sNode,sNode.parentObject);}
 else
 {if ((z==-1)||(!z.parentObject)) return;this._moveNodeTo(sNode,z.parentObject,z);}
 break;}
 if (_isIE && _isIE<8){this.allTree.childNodes[0].border = "1";this.allTree.childNodes[0].border = "0";}
}
 dhtmlXTreeObject.prototype._loadDynXML=function(id,src) {src=src||this.XMLsource;var sn=(new Date()).valueOf();this._ld_id=id;this.loadXML(src+getUrlSymbol(src)+"uid="+sn+"&id="+this._escape(id));};dhtmlXTreeObject.prototype._checkPNodes=function(item1,item2){if (this._dcheckf)return false;if (item2==item1)return 1
 if (item1.parentObject)return this._checkPNodes(item1.parentObject,item2);else return 0;};dhtmlXTreeObject.prototype.disableDropCheck = function(mode){this._dcheckf = convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.preventIECaching=function(mode){this.no_cashe = convertStringToBoolean(mode);this.XMLLoader.rSeed=this.no_cashe;}
dhtmlXTreeObject.prototype.preventIECashing=dhtmlXTreeObject.prototype.preventIECaching;dhtmlXTreeObject.prototype.disableCheckbox=function(itemId,mode) {if (typeof(itemId)!="object")
 var sNode=this._globalIdStorageFind(itemId,0,1);else
 var sNode=itemId;if (!sNode)return;sNode.dscheck=convertStringToBoolean(mode)?(((sNode.checkstate||0)%3)+3):((sNode.checkstate>2)?(sNode.checkstate-3):sNode.checkstate);this._setCheck(sNode);if (sNode.dscheck<3)sNode.dscheck=false;};dhtmlXTreeObject.prototype.setEscapingMode=function(mode){this.utfesc=mode;}
 dhtmlXTreeObject.prototype.enableHighlighting=function(mode) {this.ehlt=true;this.ehlta=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype._itemMouseOut=function(){var that=this.childNodes[3].parentObject;var tree=that.treeNod;tree.callEvent("onMouseOut",[that.id]);if (that.id==tree._l_onMSI)tree._l_onMSI=null;if (!tree.ehlta)return;that.span.className=that.span.className.replace("_lor","");}
 dhtmlXTreeObject.prototype._itemMouseIn=function(){var that=this.childNodes[3].parentObject;var tree=that.treeNod;if (tree._l_onMSI!=that.id)tree.callEvent("onMouseIn",[that.id]);tree._l_onMSI=that.id;if (!tree.ehlta)return;that.span.className=that.span.className.replace("_lor","");that.span.className=that.span.className.replace(/((standart|selected)TreeRow)/,"$1_lor");}
 dhtmlXTreeObject.prototype.enableActiveImages=function(mode){this._aimgs=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.focusItem=function(itemId){var sNode=this._globalIdStorageFind(itemId);if (!sNode)return (0);this._focusNode(sNode);};dhtmlXTreeObject.prototype.getAllSubItems =function(itemId){return this._getAllSubItems(itemId);}
 dhtmlXTreeObject.prototype.getAllChildless =function(){return this._getAllScraggyItems(this.htmlNode);}
 dhtmlXTreeObject.prototype.getAllLeafs=dhtmlXTreeObject.prototype.getAllChildless;dhtmlXTreeObject.prototype._getAllScraggyItems =function(node)
 {var z="";for (var i=0;i<node.childsCount;i++){if ((node.childNodes[i].unParsed)||(node.childNodes[i].childsCount>0))
 {if (node.childNodes[i].unParsed)var zb=this._getAllScraggyItemsXML(node.childNodes[i].unParsed,1);else
 var zb=this._getAllScraggyItems(node.childNodes[i])

 if (zb)if (z)z+=this.dlmtr+zb;else z=zb;}
 else
 if (!z)z=node.childNodes[i].id;else z+=this.dlmtr+node.childNodes[i].id;}
 return z;};dhtmlXTreeObject.prototype._getAllFatItems =function(node)
 {var z="";for (var i=0;i<node.childsCount;i++){if ((node.childNodes[i].unParsed)||(node.childNodes[i].childsCount>0))
 {if (!z)z=node.childNodes[i].id;else z+=this.dlmtr+node.childNodes[i].id;if (node.childNodes[i].unParsed)var zb=this._getAllFatItemsXML(node.childNodes[i].unParsed,1);else
 var zb=this._getAllFatItems(node.childNodes[i])

 if (zb)z+=this.dlmtr+zb;}
 }
 return z;};dhtmlXTreeObject.prototype.getAllItemsWithKids =function(){return this._getAllFatItems(this.htmlNode);}
 dhtmlXTreeObject.prototype.getAllFatItems=dhtmlXTreeObject.prototype.getAllItemsWithKids;dhtmlXTreeObject.prototype.getAllChecked=function(){return this._getAllChecked("","",1);}
 dhtmlXTreeObject.prototype.getAllUnchecked=function(itemId){if (itemId)itemId=this._globalIdStorageFind(itemId);return this._getAllChecked(itemId,"",0);}
 dhtmlXTreeObject.prototype.getAllPartiallyChecked=function(){return this._getAllChecked("","",2);}
 dhtmlXTreeObject.prototype.getAllCheckedBranches=function(){var temp = [this._getAllChecked("","",1)];var second = this._getAllChecked("","",2);if (second)temp.push(second);return temp.join(this.dlmtr);}
 dhtmlXTreeObject.prototype._getAllChecked=function(htmlNode,list,mode){if (!htmlNode)htmlNode=this.htmlNode;if (htmlNode.checkstate==mode)if (!htmlNode.nocheckbox){if (list)list+=this.dlmtr+htmlNode.id;else list=htmlNode.id;}
 var j=htmlNode.childsCount;for (var i=0;i<j;i++){list=this._getAllChecked(htmlNode.childNodes[i],list,mode);};if (list)return list;else return "";};dhtmlXTreeObject.prototype.setItemStyle=function(itemId,style_string,resetCss){var resetCss= resetCss|| false;var temp=this._globalIdStorageFind(itemId);if (!temp)return 0;if (!temp.span.style.cssText)temp.span.setAttribute("style",temp.span.getAttribute("style")+";"+style_string);else 
 temp.span.style.cssText = resetCss? style_string : temp.span.style.cssText+";"+style_string;}
dhtmlXTreeObject.prototype.enableImageDrag=function(mode){this._itim_dg=convertStringToBoolean(mode);}
 dhtmlXTreeObject.prototype.setOnDragIn=function(func){this.attachEvent("onDragIn",func);};dhtmlXTreeObject.prototype.enableDragAndDropScrolling=function(mode){this.autoScroll=convertStringToBoolean(mode);};dhtmlXTreeObject.prototype.setSkin=function(name){var tmp = this.parentObject.className.replace(/dhxtree_[^ ]*/gi,"");this.parentObject.className= tmp+" dhxtree_"+name;if (name == "dhx_terrace")this.enableTreeLines(false);};(function(){dhtmlx.extend_api("dhtmlXTreeObject",{_init:function(obj){return [obj.parent,(obj.width||"100%"),(obj.height||"100%"),(obj.root_id||0)];},
 auto_save_selection:"enableAutoSavingSelected",
 auto_tooltip:"enableAutoTooltips",
 checkbox:"enableCheckBoxes",
 checkbox_3_state:"enableThreeStateCheckboxes",
 checkbox_smart:"enableSmartCheckboxes",
 context_menu:"enableContextMenu",
 distributed_parsing:"enableDistributedParsing",
 drag:"enableDragAndDrop",
 drag_copy:"enableMercyDrag",
 drag_image:"enableImageDrag",
 drag_scroll:"enableDragAndDropScrolling",
 editor:"enableItemEditor",
 hover:"enableHighlighting",
 images:"enableTreeImages",
 image_fix:"enableIEImageFix",
 image_path:"setImagePath",
 lines:"enableTreeLines",
 loading_item:"enableLoadingItem",
 multiline:"enableMultiLineItems",
 multiselect:"enableMultiselection",
 navigation:"enableKeyboardNavigation",
 radio:"enableRadioButtons",
 radio_single:"enableSingleRadioMode",
 rtl:"enableRTL",
 search:"enableKeySearch",
 smart_parsing:"enableSmartXMLParsing",
 smart_rendering:"enableSmartRendering",
 text_icons:"enableTextSigns",
 xml:"loadXML",
 skin:"setSkin"
 },{});})();dhtmlXTreeObject.prototype._dp_init=function(dp){dp.attachEvent("insertCallback", function(upd, id, parent) {var data = this._loader.doXPath(".//item",upd);var text = data[0].getAttribute('text');this.obj.insertNewItem(parent, id, text, 0, 0, 0, 0, "CHILD");});dp.attachEvent("updateCallback", function(upd, id, parent) {var data = this._loader.doXPath(".//item",upd);var text = data[0].getAttribute('text');this.obj.setItemText(id, text);if (this.obj.getParentId(id)!= parent) {this.obj.moveItem(id, 'item_child', parent);}
 this.setUpdated(id, true, 'updated');});dp.attachEvent("deleteCallback", function(upd, id, parent) {this.obj.setUserData(id, this.action_param, "true_deleted");this.obj.deleteItem(id, false);});dp._methods=["setItemStyle","","changeItemId","deleteItem"];this.attachEvent("onEdit",function(state,id){if (state==3)dp.setUpdated(id,true)
 return true;});this.attachEvent("onDrop",function(id,id_2,id_3,tree_1,tree_2){if (tree_1==tree_2)dp.setUpdated(id,true);});this._onrdlh=function(rowId){var z=dp.getState(rowId);if (z=="inserted"){dp.set_invalid(rowId,false);dp.setUpdated(rowId,false);return true;}
 if (z=="true_deleted"){dp.setUpdated(rowId,false);return true;}
 dp.setUpdated(rowId,true,"deleted")
 return false;};this._onradh=function(rowId){dp.setUpdated(rowId,true,"inserted")
 };dp._getRowData=function(rowId){var data = {};var z=this.obj._globalIdStorageFind(rowId);var z2=z.parentObject;var i=0;for (i=0;i<z2.childsCount;i++)if (z2.childNodes[i]==z)break;data["tr_id"] = z.id;data["tr_pid"] = z2.id;data["tr_order"] = i;data["tr_text"] = z.span.innerHTML;z2=(z._userdatalist||"").split(",");for (i=0;i<z2.length;i++)data[z2[i]]=z.userData["t_"+z2[i]];return data;};};dhtmlXTreeObject.prototype.makeDraggable=function(obj,func){if (typeof(obj)!="object")
 obj=document.getElementById(obj);dragger=new dhtmlDragAndDropObject();dropper=new dhx_dragSomethingInTree();dragger.addDraggableItem(obj,dropper);obj.dragLanding=null;obj.ondragstart=dropper._preventNsDrag;obj.onselectstart=new Function("return false;");obj.parentObject=new Object;obj.parentObject.img=obj;obj.parentObject.treeNod=dropper;dropper._customDrop=func;}
dhtmlXTreeObject.prototype.makeDragable=dhtmlXTreeObject.prototype.makeDraggable;dhtmlXTreeObject.prototype.makeAllDraggable=function(func){var z=document.getElementsByTagName("div");for (var i=0;i<z.length;i++)if (z[i].getAttribute("dragInDhtmlXTree"))
 this.makeDragable(z[i],func);}
function dhx_dragSomethingInTree(){this.lWin=window;this._createDragNode=function(node){var dragSpan=document.createElement('div');dragSpan.style.position="absolute";dragSpan.innerHTML=(node.innerHTML||node.value);dragSpan.className="dragSpanDiv";return dragSpan;};this._preventNsDrag=function(e){(e||window.event).cancelBubble=true;if ((e)&&(e.preventDefault)) {e.preventDefault();return false;}
 return false;}
 
 
 
 this._nonTrivialNode=function(tree,item,bitem,source){if (this._customDrop)return this._customDrop(tree,source.img.id,item.id,bitem?bitem.id:null);var image=(source.img.getAttribute("image")||"");var id=source.img.id||"new";var text=(source.img.getAttribute("text")||(_isIE?source.img.innerText:source.img.textContent));tree[bitem?"insertNewNext":"insertNewItem"](bitem?bitem.id:item.id,id,text,"",image,image,image);}
}
dhtmlXTreeObject.prototype.enableItemEditor=function(mode){this._eItEd=convertStringToBoolean(mode);if (!this._eItEdFlag){this._edn_click_IE=true;this._edn_dblclick=true;this._ie_aFunc=this.aFunc;this._ie_dblclickFuncHandler=this.dblclickFuncHandler;this.setOnDblClickHandler(function (a,b) {if (this._edn_dblclick)this._editItem(a,b);return true;});this.setOnClickHandler(function (a,b) {this._stopEditItem(a,b);if ((this.ed_hist_clcik==a)&&(this._edn_click_IE))
 this._editItem(a,b);this.ed_hist_clcik=a;return true;});this._eItEdFlag=true;}
 };dhtmlXTreeObject.prototype.setOnEditHandler=function(func){this.attachEvent("onEdit",func);};dhtmlXTreeObject.prototype.setEditStartAction=function(click_IE, dblclick){this._edn_click_IE=convertStringToBoolean(click_IE);this._edn_dblclick=convertStringToBoolean(dblclick);};dhtmlXTreeObject.prototype._stopEdit=function(a,mode){if (this._editCell){this.dADTempOff=this.dADTempOffEd;if (this._editCell.id!=a){var editText=true;if(!mode){editText=this.callEvent("onEdit",[2,this._editCell.id,this,this._editCell.span.childNodes[0].value]);}
 else{editText = false;this.callEvent("onEditCancel",[this._editCell.id,this._editCell._oldValue]);}
 if (editText===true)editText=this._editCell.span.childNodes[0].value;else if (editText===false)editText=this._editCell._oldValue;var changed = (editText!=this._editCell._oldValue);this._editCell.span.innerHTML=editText;this._editCell.label=this._editCell.span.innerHTML;var cSS=this._editCell.i_sel?"selectedTreeRow":"standartTreeRow";this._editCell.span.className=cSS;this._editCell.span.parentNode.className="standartTreeRow";this._editCell.span.style.paddingRight=this._editCell.span.style.paddingLeft='5px';this._editCell.span.onclick=this._editCell.span.ondblclick=function(){};var id=this._editCell.id;if (this.childCalc)this._fixChildCountLabel(this._editCell);this._editCell=null;if(!mode)this.callEvent("onEdit",[3,id,this,changed]);if (this._enblkbrd){this.parentObject.lastChild.focus();this.parentObject.lastChild.focus();}
 }
 }
}
dhtmlXTreeObject.prototype._stopEditItem=function(id,tree){this._stopEdit(id);};dhtmlXTreeObject.prototype.stopEdit=function(mode){if (this._editCell)this._stopEdit(this._editCell.id+"_non",mode);}
dhtmlXTreeObject.prototype.editItem=function(id){this._editItem(id,this);}
dhtmlXTreeObject.prototype._editItem=function(id,tree){if (this._eItEd){this._stopEdit();var temp=this._globalIdStorageFind(id);if (!temp)return;editText=this.callEvent("onEdit",[0,id,this,temp.span.innerHTML]);if (editText===true)editText = (temp.span.innerText||temp.span.textContent);else if (editText===false)return;this.dADTempOffEd=this.dADTempOff;this.dADTempOff=false;this._editCell=temp;temp._oldValue=editText;temp.span.innerHTML="<input type='text' class='intreeeditRow' />";temp.span.style.paddingRight=temp.span.style.paddingLeft='0px';temp.span.onclick = temp.span.ondblclick= function(e){(e||event).cancelBubble = true;}
 temp.span.childNodes[0].value=editText;temp.span.childNodes[0].onselectstart=function(e){(e||event).cancelBubble=true;return true;}
 temp.span.childNodes[0].onmousedown=function(e){(e||event).cancelBubble=true;return true;}
 temp.span.childNodes[0].focus();temp.span.childNodes[0].focus();temp.span.onclick=function (e){(e||event).cancelBubble=true;return false;};temp.span.className="";temp.span.parentNode.className="";var self=this;temp.span.childNodes[0].onkeydown=function(e){if (!e)e=window.event;if (e.keyCode==13){e.cancelBubble=true;self._stopEdit(window.undefined);}
 else if (e.keyCode==27){self._editCell.span.childNodes[0].value=self._editCell._oldValue;self._stopEdit(window.undefined);}
 (e||event).cancelBubble=true;}
 this.callEvent("onEdit",[1,id,this]);}
};function jsonPointer(data,parent){this.d=data;this.dp=parent;}
jsonPointer.prototype={text:function(){var afff=function(n){var p=[];for(var i=0;i<n.length;i++)p.push("{"+sfff(n[i])+"}");return p.join(",");};var sfff=function(n){var p=[];for (var a in n)if (typeof(n[a])=="object"){if (a.length)p.push('"'+a+'":['+afff(n[a])+"]");else p.push('"'+a+'":{'+sfff(n[a])+"}");}else p.push('"'+a+'":"'+n[a]+'"');return p.join(",");};return "{"+sfff(this.d)+"}";},
 get:function(name){return this.d[name];},
 exists:function(){return !!this.d },
 content:function(){return this.d.content;},
 each:function(name,f,t){var a=this.d[name];var c=new jsonPointer();if (a)for (var i=0;i<a.length;i++){c.d=a[i];f.apply(t,[c,i]);}},
 get_all:function(){return this.d;},
 sub:function(name){return new jsonPointer(this.d[name],this.d) },
 sub_exists:function(name){return !!this.d[name];},
 each_x:function(name,rule,f,t,i){var a=this.d[name];var c=new jsonPointer(0,this.d);if (a)for (i=i||0;i<a.length;i++)if (a[i][rule]){c.d=a[i];if(f.apply(t,[c,i])==-1) return;}},
 up:function(name){return new jsonPointer(this.dp,this.d);},
 set:function(name,val){this.d[name]=val;},
 clone:function(name){return new jsonPointer(this.d,this.dp);},
 through:function(name,rule,v,f,t){var a=this.d[name];if (a.length)for (var i=0;i<a.length;i++){if (a[i][rule]!=null && a[i][rule]!="" && (!v || a[i][rule]==v )) {var c=new jsonPointer(a[i],this.d);f.apply(t,[c,i]);}var w=this.d;this.d=a[i];if (this.sub_exists(name)) this.through(name,rule,v,f,t);this.d=w;}}
}
 dhtmlXTreeObject.prototype.loadJSArrayFile=function(file,afterCall){if (!this.parsCount)this.callEvent("onXLS",[this,this._ld_id]);this._ld_id=null;this.xmlstate=1;var that=this;this.XMLLoader=new dtmlXMLLoaderObject(function(){eval("var z="+arguments[4].xmlDoc.responseText);that.loadJSArray(z);},this,true,this.no_cashe);if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXML(file);};dhtmlXTreeObject.prototype.loadCSV=function(file,afterCall){if (!this.parsCount)this.callEvent("onXLS",[this,this._ld_id]);this._ld_id=null;this.xmlstate=1;var that=this;this.XMLLoader=new dtmlXMLLoaderObject(function(){that.loadCSVString(arguments[4].xmlDoc.responseText);},this,true,this.no_cashe);if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXML(file);};dhtmlXTreeObject.prototype.loadJSArray=function(ar,afterCall){var z=[];for (var i=0;i<ar.length;i++){if (!z[ar[i][1]])z[ar[i][1]]=[];z[ar[i][1]].push({id:ar[i][0],text:ar[i][2]});}
 
 var top={id: this.rootId};var f=function(top,f){if (z[top.id]){top.item=z[top.id];for (var j=0;j<top.item.length;j++)f(top.item[j],f);}
 }
 f(top,f);this.loadJSONObject(top,afterCall);}
dhtmlXTreeObject.prototype.loadCSVString=function(csv,afterCall){var z=[];var ar=csv.split("\n");for (var i=0;i<ar.length;i++){var t=ar[i].split(",");if (!z[t[1]])z[t[1]]=[];z[t[1]].push({id:t[0],text:t[2]});}
 
 var top={id: this.rootId};var f=function(top,f){if (z[top.id]){top.item=z[top.id];for (var j=0;j<top.item.length;j++)f(top.item[j],f);}
 }
 f(top,f);this.loadJSONObject(top,afterCall);}
 dhtmlXTreeObject.prototype.loadJSONObject=function(json,afterCall){if (!this.parsCount)this.callEvent("onXLS",[this,null]);this.xmlstate=1;var p=new jsonPointer(json);this._parse(p);this._p=p;if (afterCall)afterCall();};dhtmlXTreeObject.prototype.loadJSON=function(file,afterCall){if (!this.parsCount)this.callEvent("onXLS",[this,this._ld_id]);this._ld_id=null;this.xmlstate=1;var that=this;this.XMLLoader=new dtmlXMLLoaderObject(function(){try {eval("var t="+arguments[4].xmlDoc.responseText);}catch(e){dhtmlxError.throwError("LoadXML", "Incorrect JSON", [
 (arguments[4].xmlDoc),
 this
 ]);return;}
 var p=new jsonPointer(t);that._parse(p);that._p=p;},this,true,this.no_cashe);if (afterCall)this.XMLLoader.waitCall=afterCall;this.XMLLoader.loadXML(file);};dhtmlXTreeObject.prototype.serializeTreeToJSON=function(){var out=['{"id":"'+this.rootId+'", "item":['];var p=[];for (var i=0;i<this.htmlNode.childsCount;i++)p.push(this._serializeItemJSON(this.htmlNode.childNodes[i]));out.push(p.join(","));out.push("]}");return out.join("");};dhtmlXTreeObject.prototype._serializeItemJSON=function(itemNode){var out=[];if (itemNode.unParsed)return (itemNode.unParsed.text());if (this._selected.length)var lid=this._selected[0].id;else lid="";var text=itemNode.span.innerHTML;text=text.replace(/\"/g, "\\\"", text);if (!this._xfullXML)out.push('{"id":"'+itemNode.id+'", '+(this._getOpenState(itemNode)==1?' "open":"1", ':'')+(lid==itemNode.id?' "select":"1",':'')+' "text":"'+text+'"'+( ((this.XMLsource)&&(itemNode.XMLload==0))?', "child":"1" ':''));else
 out.push('{"id":"'+itemNode.id+'", '+(this._getOpenState(itemNode)==1?' "open":"1", ':'')+(lid==itemNode.id?' "select":"1",':'')+' "text":"'+text+'", "im0":"'+itemNode.images[0]+'", "im1":"'+itemNode.images[1]+'", "im2":"'+itemNode.images[2]+'" '+(itemNode.acolor?(', "aCol":"'+itemNode.acolor+'" '):'')+(itemNode.scolor?(', "sCol":"'+itemNode.scolor+'" '):'')+(itemNode.checkstate==1?', "checked":"1" ':(itemNode.checkstate==2?', "checked":"-1"':''))+(itemNode.closeable?', "closeable":"1" ':'')+( ((this.XMLsource)&&(itemNode.XMLload==0))?', "child":"1" ':''));if ((this._xuserData)&&(itemNode._userdatalist))
 {out.push(', "userdata":[');var names=itemNode._userdatalist.split(",");var p=[];for (var i=0;i<names.length;i++)p.push('{"name":"'+names[i]+'" , "content":"'+itemNode.userData["t_"+names[i]]+'" }');out.push(p.join(","));out.push("]");}
 
 if (itemNode.childsCount){out.push(', "item":[');var p=[];for (var i=0;i<itemNode.childsCount;i++)p.push(this._serializeItemJSON(itemNode.childNodes[i]));out.push(p.join(","));out.push("]\n");}
 
 out.push("}\n")
 return out.join("");}




function dhtmlXTreeFromHTML(obj){if (typeof(obj)!="object")
 obj=document.getElementById(obj);var n=obj;var id=n.id;var cont="";for (var j=0;j<obj.childNodes.length;j++)if (obj.childNodes[j].nodeType=="1"){if (obj.childNodes[j].tagName=="XMP"){var cHead=obj.childNodes[j];for (var m=0;m<cHead.childNodes.length;m++)cont+=cHead.childNodes[m].data;}
 else if (obj.childNodes[j].tagName.toLowerCase()=="ul")
 cont=dhx_li2trees(obj.childNodes[j],new Array(),0);break;}
 obj.innerHTML="";var t=new dhtmlXTreeObject(obj,"100%","100%",0);var z_all=new Array();for ( b in t )z_all[b.toLowerCase()]=b;var atr=obj.attributes;for (var a=0;a<atr.length;a++)if ((atr[a].name.indexOf("set")==0)||(atr[a].name.indexOf("enable")==0)){var an=atr[a].name;if (!t[an])an=z_all[atr[a].name];t[an].apply(t,atr[a].value.split(","));}
 if (typeof(cont)=="object"){t.XMLloadingWarning=1;for (var i=0;i<cont.length;i++){var n=t.insertNewItem(cont[i][0],cont[i][3],cont[i][1]);if (cont[i][2])t._setCheck(n,cont[i][2]);}
 t.XMLloadingWarning=0;t.lastLoadedXMLId=0;t._redrawFrom(t);}
 else
 t.loadXMLString("<tree id='0'>"+cont+"</tree>");window[id]=t;var oninit = obj.getAttribute("oninit");if (oninit)eval(oninit);return t;}
function dhx_init_trees(){var z=document.getElementsByTagName("div");for (var i=0;i<z.length;i++)if (z[i].className=="dhtmlxTree")dhtmlXTreeFromHTML(z[i])
}
function dhx_li2trees(tag,data,ind){for (var i=0;i<tag.childNodes.length;i++){var z=tag.childNodes[i];if ((z.nodeType==1)&&(z.tagName.toLowerCase()=="li")){var c="";var ul=null;var check=z.getAttribute("checked");for (var j=0;j<z.childNodes.length;j++){var zc=z.childNodes[j];if (zc.nodeType==3)c+=zc.data;else if (zc.tagName.toLowerCase()!="ul") c+=dhx_outer_html(zc);else ul=zc;}
 data[data.length]=[ind,c,check,(z.id||(data.length+1))];if (ul)data=dhx_li2trees(ul,data,(z.id||data.length));}
 }
 return data;}
function dhx_outer_html(node){if (node.outerHTML)return node.outerHTML;var temp=document.createElement("DIV");temp.appendChild(node.cloneNode(true));temp=temp.innerHTML;return temp;}
if (window.addEventListener)window.addEventListener("load",dhx_init_trees,false);else if (window.attachEvent)window.attachEvent("onload",dhx_init_trees);function dhtmlXWindowsSngl(){}
function dhtmlXWindowsBtn(){}
function dhtmlXWindows() {if (!window.dhtmlXContainer){alert(this.i18n.dhx);return;}
 
 this.engine = "dhx";var engineFunc = "_"+this.engine+"_Engine";if (!this[engineFunc]){alert(this.i18n.noenginealert);return;}else {this[engineFunc]();}
 
 this._isIPad = (navigator.userAgent.search(/iPad/gi)>=0);var that = this;this.pathPrefix = "dhxwins_";this.imagePath = dhtmlx.image_path||"codebase/imgs/";this.setImagePath = function(path) {this.imagePath = path;}
 
 
 this.skin = (typeof(dhtmlx) != "undefined" && typeof(dhtmlx.skin) == "string" ? dhtmlx.skin : "dhx_skyblue");this.skinParams = {"dhx_black" : {"header_height": 21, "border_left_width": 2, "border_right_width": 2, "border_bottom_height": 2 },
 "dhx_blue" : {"header_height": 21, "border_left_width": 2, "border_right_width": 2, "border_bottom_height": 2 },
 "dhx_skyblue" : {"header_height": 21, "border_left_width": 2, "border_right_width": 2, "border_bottom_height": 2 }
 };this.setSkin = function(skin) {this.skin = skin;this._engineRedrawSkin();}
 
 
 
 this.isWindow = function(id) {var t = (this.wins[id] != null);return t;}
 
 
 this.findByText = function(text) {var wins = new Array();for (var a in this.wins){if (this.wins[a].getText().search(text, "gi") >= 0) {wins[wins.length] = this.wins[a];}
 }
 return wins;}
 
 
 this.window = function(id) {var win = null;if (this.wins[id] != null){win = this.wins[id];}
 return win;}
 
 
 this.forEachWindow = function(handler) {for (var a in this.wins){handler(this.wins[a]);}
 }
 
 
 
 this.getBottommostWindow = function() {var bottommost = this.getTopmostWindow();for (var a in this.wins){if (this.wins[a].zi < bottommost.zi){bottommost = this.wins[a];}
 }
 return (bottommost.zi != 0 ? bottommost : null);}
 
 
 this.getTopmostWindow = function(visibleOnly) {var topmost = {"zi": 0};for (var a in this.wins){if (this.wins[a].zi > topmost.zi){if (visibleOnly == true && !this._isWindowHidden(this.wins[a])) {topmost = this.wins[a];}
 if (visibleOnly != true){topmost = this.wins[a];}
 }
 }
 return (topmost.zi != 0 ? topmost : null);}
 
 
 this.wins = {};for (var a in this.wins)delete this.wins[a];this.autoViewport = true;this._createViewport = function() {this.vp = document.body;this._clearVPCss();this.vp._css = (String(this.vp.className).length > 0 ? this.vp.className : "");this.vp.className += " dhtmlx_skin_"+this.skin+(this._r?" dhx_wins_rtl":"");this.modalCoverI = document.createElement("IFRAME");this.modalCoverI.frameBorder = "0";this.modalCoverI.className = "dhx_modal_cover_ifr";this.modalCoverI.setAttribute("src","javascript:false;");this.modalCoverI.style.display = "none";this.modalCoverI.style.zIndex = 0;this.vp.appendChild(this.modalCoverI);this.modalCoverD = document.createElement("DIV");this.modalCoverD.className = "dhx_modal_cover_dv";this.modalCoverD.style.display = "none";this.modalCoverD.style.zIndex = 0;this.vp.appendChild(this.modalCoverD);this._vpcover = document.createElement("DIV");this._vpcover.className = "dhx_content_vp_cover";this._vpcover.style.display = "none";this.vp.appendChild(this._vpcover);this._carcass = document.createElement("DIV");this._carcass.className = "dhx_carcass_resmove";this._carcass.style.display = "none";if (_isIE){this._carcass.innerHTML = "<iframe border=0 frameborder=0 style='filter: alpha(opacity=0);width: 100%;height:100%;position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;'></iframe><div style='position: absolute;top: 0px;left: 0px;width: 100%;height: 100%;'></div>";this._carcass.childNodes[0].setAttribute("src","javascript:false;");}
 this._carcass.onselectstart = function(e) {e = e||event;e.returnValue = false;}
 this.vp.appendChild(this._carcass);}
 this._clearVPCss = function(css) {this.vp.className = String(this.vp.className).replace(/[a-z_]{1,}/gi,function(t){return({"dhtmlx_skin_dhx_skyblue":1,"dhtmlx_skin_dhx_blue":1,"dhtmlx_skin_dhx_black":1,"dhtmlx_skin_dhx_web":1,"dhtmlx_skin_dhx_terrace":1}[t]==1?"":t);});}
 this._autoResizeViewport = function() {for (var a in this.wins){if (this.wins[a]._isFullScreened){this.wins[a]._content.style.width = document.body.offsetWidth-(_isIE?4:0)+"px";if (document.body.offsetHeight == 0){if (window.innerHeight){this.wins[a]._content.style.height = window.innerHeight+"px";}else {this.wins[a]._content.style.height = document.body.scrollHeight+"px";}
 }else {this.wins[a]._content.style.height = document.body.offsetHeight-(_isIE?4:0)+"px";}
 
 if (this.wins[a].layout != null && _isOpera){this.wins[a].layout._fixCellsContentOpera950();}
 this.wins[a].updateNestedObjects();}
 if (this.wins[a]._isMaximized && this.wins[a].style.display != "none"){this._restoreWindow(a);this._maximizeWindow(a);}
 }
 
 if (this.vp == document.body)return;if (this.autoViewport == false)return;this.vp.style.width = (_isIE ? document.body.offsetWidth - 4 : window.innerWidth) + "px";this.vp.style.height = (_isIE ? document.body.offsetHeight - 4 : window.innerHeight) + "px";for (var a in this.wins){var win = this.wins[a];var overX = false;var overY = false;if (win.x > this.vp.offsetWidth - 10){win.x = this.vp.offsetWidth - 10;overX = true;}
 var skinParams = (win._skinParams!=null?win._skinParams:this.skinParams[this.skin]);if (win.y + skinParams["header_height"] > this.vp.offsetHeight){win.y = this.vp.offsetHeight - skinParams["header_height"];overY = true;}
 if (overX || overY){this._engineRedrawWindowPos(win);}
 }
 }
 
 this.enableAutoViewport = function(state) {if (this.vp != document.body)return;this.autoViewport = state;if (state == false){if (this.vp == document.body)document.body.className = this.vp._css;this.vp.removeChild(this.modalCoverI);this.vp.removeChild(this.modalCoverD);this.vp.removeChild(this._vpcover);this.vp.removeChild(this._carcass);this.vp = null;this.vp = document.createElement("DIV");this.vp.autocreated = true;this.vp.className = "dhtmlx_winviewport dhtmlx_skin_"+this.skin+(this._r?" dhx_wins_rtl":"");this.vp.style.left = "0px";this.vp.style.top = "0px";document.body.appendChild(this.vp);this.vp.ax = 0;this.vp.ay = 0;this._autoResizeViewport();this.vp.appendChild(this.modalCoverI);this.vp.appendChild(this.modalCoverD);this.vp.appendChild(this._vpcover);this.vp.appendChild(this._carcass);}
 }
 
 this.attachViewportTo = function(objId) {if (this.autoViewport == false){this.vp.removeChild(this.modalCoverI);this.vp.removeChild(this.modalCoverD);this.vp.removeChild(this._vpcover);this.vp.removeChild(this._carcass);if (this.vp != document.body)this.vp.parentNode.removeChild(this.vp);this.vp = null;this.vp = (typeof(objId)=="string"?document.getElementById(objId):objId);this.vp.autocreated = false;this._clearVPCss();this.vp.className += " dhtmlx_skin_"+this.skin+(this._r?" dhx_wins_rtl":"");this.vp.style.position = "relative";this.vp.style.overflow = "hidden";this.vp.ax = 0;this.vp.ay = 0;this.vp.appendChild(this.modalCoverI);this.vp.appendChild(this.modalCoverD);this.vp.appendChild(this._vpcover);this.vp.appendChild(this._carcass);}
 }
 
 this.setViewport = function(x, y, width, height, parentObj) {if (this.autoViewport == false){this.vp.style.left = x + "px";this.vp.style.top = y + "px";this.vp.style.width = width + "px";this.vp.style.height = height + "px";if (parentObj != null){parentObj.appendChild(this.vp);}
 this.vp.ax = getAbsoluteLeft(this.vp);this.vp.ay = getAbsoluteTop(this.vp);}
 }
 
 this._effects = {"move" : false, "resize" : false};this.setEffect = function(efName, efValue) {if ((this._effects[efName] != null)&& (typeof(efValue) == "boolean")) {this._effects[efName] = efValue;}
 }
 
 this.getEffect = function(efName) {return this._effects[efName];}
 
 
 this.createWindow = function(id, x, y, width, height) {var win = document.createElement("DIV");win.className = "dhtmlx_window_inactive";win.dir = "ltr";for (var a in this.wins){this.wins[a].zi += this.zIndexStep;this.wins[a].style.zIndex = this.wins[a].zi;}
 
 win.zi = this.zIndexStep;win.style.zIndex = win.zi;win.active = false;win._isWindow = true;win.isWindow = true;win.w = Number(width);win.h = Number(height);win.x = x;win.y = y;this._engineFixWindowPosInViewport(win);win._isModal = false;win._allowResize = true;win.maxW = "auto";win.maxH = "auto";win.minW = 200;win.minH = 140;win.iconsPresent = true;win.icons = new Array(this.imagePath+this.pathPrefix+this.skin+"/active/icon_normal.gif", this.imagePath+this.pathPrefix+this.skin+"/inactive/icon_normal.gif");win._allowMove = true;win._allowMoveGlobal = true;win._allowResizeGlobal = true;win._keepInViewport = false;var skin = this.skinParams[this.skin];win.idd = id;this.vp.appendChild(win);this._engineSetWindowBody(win);this._engineRedrawWindowPos(win);this._engineRedrawWindowSize(win);this._engineUpdateWindowIcon(win, win.icons[0]);this._engineDiableOnSelectInWindow(win, true);this.wins[id] = win;dhtmlxEventable(win);this._engineGetWindowHeader(win)[this._isIPad?"ontouchstart":"onmousedown"] = function(e) {e = e||event;var w = that.wins[this.idd];if (!w.isOnTop()) w.bringToTop();if (that._engineGetWindowHeaderState(w)) return;if (!that._engineCheckHeaderMouseDown(w, e)) return;if (!w._allowMove || !w._allowMoveGlobal)return;that._wasMoved = false;w.moveOffsetX = w.x - (that._isIPad?e.touches[0].clientX:e.clientX);w.moveOffsetY = w.y - (that._isIPad?e.touches[0].clientY:e.clientY);that.movingWin = w;if (that._effects["move"] == false){that._carcass.x = that.movingWin.x;that._carcass.y = that.movingWin.y;that._carcass.w = parseInt(that.movingWin.style.width)+(_isIE?0:-2);that._carcass.h = parseInt(that.movingWin.style.height)+(_isIE?0:-2);that._carcass.style.left = that._carcass.x+"px";that._carcass.style.top = that._carcass.y+"px";that._carcass.style.width = that._carcass.w+"px";that._carcass.style.height = that._carcass.h+"px";that._carcass.style.zIndex = that._getTopZIndex(true)+1;that._carcass._keepInViewport = win._keepInViewport;}
 that._blockSwitcher(true);that._vpcover.style.zIndex = that.movingWin.style.zIndex-1;that._vpcover.style.display = "";e.returnValue = false;e.cancelBubble = true;return false;}
 
 this._engineGetWindowHeader(win).ondblclick = function(e) {var w = that.wins[this.idd];if (!that._engineCheckHeaderMouseDown(w, e||event)) {return;}
 if (w._allowResizeGlobal && !w._isParked){if (w._isMaximized == true){that._restoreWindow(w.idd);}else {that._maximizeWindow(w.idd);}
 }
 
 
 
 
 w = null;}
 
 
 
 win.setText = function(text) {that._engineGetWindowLabel(this).innerHTML = text;}
 
 
 win.getText = function() {return that._engineGetWindowLabel(this).innerHTML;}
 
 
 win.getId = function() {return this.idd;}
 
 
 win.show = function() {that._showWindow(this);}
 
 
 win.hide = function() {that._hideWindow(this);}
 
 
 win.minimize = function() {that._restoreWindow(this.idd);}
 
 
 win.maximize = function() {that._maximizeWindow(this.idd);}
 
 
 win.close = function() {that._closeWindow(this.idd);}
 
 
 win.park = function() {if (this._isParkedAllowed){that._parkWindow(this.winId);}
 }
 
 
 win.stick = function() {that._stickWindow(this.idd);}
 
 win.unstick = function() {that._unstickWindow(this.idd);}
 
 win.isSticked = function() {return this._isSticked;}
 
 
 win.setIcon = function(iconEnabled, iconDisabled) {that._setWindowIcon(win, iconEnabled, iconDisabled);}
 
 
 win.getIcon = function() {return that._getWindowIcon(this);}
 
 
 win.clearIcon = function() {that._clearWindowIcons(this);}
 
 
 win.restoreIcon = function() {that._restoreWindowIcons(this);}
 
 
 win.keepInViewport = function(state) {this._keepInViewport = state;}
 
 
 win.setModal = function(state) {if (state == true){if (that.modalWin != null || that.modalWin == this)return;that._setWindowModal(this, true);}else {if (that.modalWin != this)return;that._setWindowModal(this, false);}
 }
 
 
 win.isModal = function() {return this._isModal;}
 
 
 win.isHidden = function() {return that._isWindowHidden(this);}
 
 
 win.isMaximized = function() {return this._isMaximized;}
 
 
 win.isParked = function() {return this._isParked;}
 
 
 win.allowPark = function() {that._allowParking(this);}
 
 win.denyPark = function() {that._denyParking(this);}
 
 win.isParkable = function() {return this._isParkedAllowed;}
 
 
 win.allowResize = function() {that._allowReszieGlob(this);}
 
 win.denyResize = function() {that._denyResize(this);}
 
 
 win.isResizable = function() {return this._allowResizeGlobal;}
 
 
 win.allowMove = function() {if (!this._isMaximized){this._allowMove = true;}
 this._allowMoveGlobal = true;}
 
 win.denyMove = function() {this._allowMoveGlobal = false;}
 
 win.isMovable = function() {return this._allowMoveGlobal;}
 
 
 win.bringToTop = function() {that._bringOnTop(this);that._makeActive(this);}
 
 
 win.bringToBottom = function() {that._bringOnBottom(this);}
 
 
 win.isOnTop = function() {return that._isWindowOnTop(this);}
 
 
 win.isOnBottom = function() {return that._isWindowOnBottom(this);}
 
 
 win.setPosition = function(x, y) {this.x = x;this.y = y;that._engineFixWindowPosInViewport(this);that._engineRedrawWindowPos(this);}
 
 
 win.getPosition = function() {return new Array(this.x, this.y);}
 
 
 win.setDimension = function(width, height) {if (width != null){if (this.maxW != "auto")if (width > this.maxW)width = this.maxW;if (width < this.minW)width = this.minW;this.w = width;}
 if (height != null){if (this.maxH != "auto")if (height > this.maxH)height = this.maxH;if (height < this.minH)height = this.minH;this.h = height;}
 that._fixWindowDimensionInViewport(this);that._engineFixWindowPosInViewport(this);that._engineRedrawWindowSize(this);this.updateNestedObjects();}
 
 
 win.getDimension = function() {return new Array(this.w, this.h);}
 
 
 win.setMaxDimension = function(maxWidth, maxHeight) {this.maxW = (isNaN(maxWidth)?"auto":maxWidth);this.maxH = (isNaN(maxHeight)?"auto":maxHeight);that._engineRedrawWindowSize(this);}
 
 
 win.getMaxDimension = function() {return new Array(this.maxW, this.maxH);}
 
 
 win.setMinDimension = function(minWidth, minHeight) {if (minWidth != null){this.minW = minWidth;}
 if (minHeight != null){this.minH = minHeight;}
 that._fixWindowDimensionInViewport(this);that._engineRedrawWindowPos(this);}
 
 
 win.getMinDimension = function() {return new Array(this.minW, this.minH);}
 
 win._adjustToContent = function(cw, ch) {that._engineAdjustWindowToContent(this, cw, ch);}
 win._doOnAttachMenu = function() {that._engineRedrawWindowSize(this);this.updateNestedObjects();}
 win._doOnAttachToolbar = function() {that._engineRedrawWindowSize(this);this.updateNestedObjects();}
 win._doOnAttachStatusBar = function() {that._engineRedrawWindowSize(this);this.updateNestedObjects();}
 win._doOnFrameMouseDown = function() {this.bringToTop();}
 win._doOnFrameContentLoaded = function() {that.callEvent("onContentLoaded",[this]);}
 

 
 
 win.addUserButton = function(id, pos, title, label) {var userBtn = that._addUserButton(this, id, pos, title, label);return userBtn;}
 
 
 win.removeUserButton = function(id) {id = String(id).toLowerCase();if (!((id == "minmax1")|| (id == "minmax2") || (id == "park") || (id == "close") || (id == "stick") || (id == "unstick") || (id == "help"))) {if (btn != null){that._removeUserButton(this, id);}
 }
 }
 
 win.progressOn = function() {that._engineSwitchWindowProgress(this, true);}
 
 win.progressOff = function() {that._engineSwitchWindowProgress(this, false);}
 
 win.setToFullScreen = function(state) {that._setWindowToFullScreen(this, state);}
 
 win.showHeader = function() {that._engineSwitchWindowHeader(this, true);}
 
 win.hideHeader = function() {that._engineSwitchWindowHeader(this, false);}
 
 win.progressOff();win.canStartResize = false;win.onmousemove = function(e) {if (_isIE && this._isMaximized)return true;e = e || event;var targetObj = e.target || e.srcElement;if (String(targetObj.className).search("dhtmlx_wins_resizer") < 0) targetObj = null;if (!this._allowResize || this._allowResizeGlobal == false || !targetObj){if (targetObj){if (targetObj.style.cursor != "default")targetObj.style.cursor = "default";}
 if (this.style.cursor != "default")this.style.cursor = "default";this.canStartResize = false;return true;}
 
 if (that.resizingWin != null)return;if (that.movingWin != null)return;if (this._isParked)return;if (that._isIPad){var px = e.touches[0].clientX;var py = e.touches[0].clientY;}else {var px = (_isIE||_isOpera?e.offsetX:e.layerX);var py = (_isIE||_isOpera?e.offsetY:e.layerY);}
 
 
 var resDir = that._engineAllowWindowResize(win, targetObj, px, py);if (resDir == null){this.canStartResize = false;if (targetObj.style.cursor != "default")targetObj.style.cursor = "default";if (this.style.cursor != "default")this.style.cursor = "default";return;}
 
 that.resizingDirs = resDir;var xy = {x:e.clientX,y:e.clientY};switch (that.resizingDirs) {case "border_left":
 targetObj.style.cursor = "w-resize";this.resizeOffsetX = this.x - xy.x;break;case "border_right":
 targetObj.style.cursor = "e-resize";this.resizeOffsetXW = this.x + this.w - xy.x;break;case "border_top":
 targetObj.style.cursor = "n-resize";this.resizeOffsetY = this.y - xy.y;break;case "border_bottom":
 targetObj.style.cursor = "n-resize";this.resizeOffsetYH = this.y + this.h - xy.y;break;case "corner_left":
 targetObj.style.cursor = "sw-resize";this.resizeOffsetX = this.x - e.clientX;this.resizeOffsetYH = this.y + this.h - xy.y;break;case "corner_up_left":
 targetObj.style.cursor = "nw-resize";this.resizeOffsetY = this.y - xy.y;this.resizeOffsetX = this.x - xy.x;break;case "corner_right":
 targetObj.style.cursor = "nw-resize";this.resizeOffsetXW = this.x + this.w - xy.x;this.resizeOffsetYH = this.y + this.h - xy.y;break;case "corner_up_right":
 targetObj.style.cursor = "sw-resize";this.resizeOffsetY = this.y - xy.y;this.resizeOffsetXW = this.x + this.w - xy.x;break;}
 this.canStartResize = true;this.style.cursor = targetObj.style.cursor;e.cancelBubble = true;e.returnValue = false;return false;}
 win.onmousedown = function(e) {if (that._getActive()!= this) that._makeActive(this);that._bringOnTop(this);if (this.canStartResize){that._blockSwitcher(true);that.resizingWin = this;if (!that._effects["resize"]){that._carcass.x = that.resizingWin.x;that._carcass.y = that.resizingWin.y;that._carcass.w = Number(that.resizingWin.w)+(_isIE?0:-2);that._carcass.h = Number(that.resizingWin.h)+(_isIE?0:-2);that._carcass.style.left = that._carcass.x+"px";that._carcass.style.top = that._carcass.y+"px";that._carcass.style.width = that._carcass.w+"px";that._carcass.style.height = that._carcass.h+"px";that._carcass.style.zIndex = that._getTopZIndex(true)+1;that._carcass.style.cursor = this.style.cursor;that._carcass._keepInViewport = this._keepInViewport;that._carcass.style.display = "";}
 
 that._vpcover.style.zIndex = that.resizingWin.style.zIndex-1;that._vpcover.style.display = "";if (this.vs[this.av].layout){this.callEvent("_onBeforeTryResize", [this]);}
 e = e||event;}
 
 }
 
 this._addDefaultButtons(win.idd);win.button = function(id) {id = String(id).toLowerCase();var b = null;if (this.btns[id] != null){b = this.btns[id];}
 return b;}
 
 
 win.center = function() {that._centerWindow(this, false);}
 
 win.centerOnScreen = function() {that._centerWindow(this, true);}
 
 
 
 win._attachContent("empty", null);win._redraw = function() {that._engineRedrawWindowSize(this);}
 
 win.bringToTop();this._engineRedrawWindowSize(win);return this.wins[id];}
 
 this.zIndexStep = 50;this._getTopZIndex = function(ignoreSticked) {var topZIndex = 0;for (var a in this.wins){if (ignoreSticked == true){if (this.wins[a].zi > topZIndex){topZIndex = this.wins[a].zi;}
 }else {if (this.wins[a].zi > topZIndex && !this.wins[a]._isSticked){topZIndex = this.wins[a].zi;}
 }
 }
 return topZIndex;}
 
 this.movingWin = null;this._moveWindow = function(e) {if (this.movingWin != null){if (!this.movingWin._allowMove || !this.movingWin._allowMoveGlobal){return;}
 if (this._effects["move"] == true){if (this._engineGetWindowHeader(this.movingWin).style.cursor != "move") {this._engineGetWindowHeader(this.movingWin).style.cursor = "move";}
 
 this._wasMoved = true;this.movingWin.x = (this._isIPad?e.touches[0].clientX:e.clientX) + this.movingWin.moveOffsetX;this.movingWin.y = (this._isIPad?e.touches[0].clientY:e.clientY) + this.movingWin.moveOffsetY;this._engineFixWindowPosInViewport(this.movingWin);this._engineRedrawWindowPos(this.movingWin);}else {if (this._carcass.style.display != ""){this._carcass.style.display = "";}
 
 if (this._carcass.style.cursor != "move"){this._carcass.style.cursor = "move";}
 if (this._engineGetWindowHeader(this.movingWin).style.cursor != "move") {this._engineGetWindowHeader(this.movingWin).style.cursor = "move";}
 
 this._carcass.x = (this._isIPad?e.touches[0].clientX:e.clientX) + this.movingWin.moveOffsetX;this._carcass.y = (this._isIPad?e.touches[0].clientY:e.clientY) + this.movingWin.moveOffsetY;this._wasMoved = true;this._engineFixWindowPosInViewport(this._carcass);this._carcass.style.left = this._carcass.x+"px";this._carcass.style.top = this._carcass.y+"px";}
 }
 
 if (this.resizingWin != null){if (!this.resizingWin._allowResize){return;}
 
 
 
 var xy = {x:e.clientX,y:e.clientY};if (this.resizingDirs == "border_left" || this.resizingDirs == "corner_left" || this.resizingDirs == "corner_up_left"){if (this._effects["resize"]){var ofs = xy.x + this.resizingWin.resizeOffsetX;var sign = (ofs > this.resizingWin.x ? -1 : 1);newW = this.resizingWin.w + Math.abs(ofs - this.resizingWin.x)*sign;if ((newW < this.resizingWin.minW)&& (sign < 0)) {this.resizingWin.x = this.resizingWin.x + this.resizingWin.w - this.resizingWin.minW;this.resizingWin.w = this.resizingWin.minW;}else {this.resizingWin.w = newW;this.resizingWin.x = ofs;}
 this._engineRedrawWindowPos(this.resizingWin);this._engineRedrawWindowSize(this.resizingWin);}else {var ofs = xy.x + this.resizingWin.resizeOffsetX;var sign = (ofs > this._carcass.x ? -1 : 1);newW = this._carcass.w + Math.abs(ofs - this._carcass.x)*sign;if (newW > this.resizingWin.maxW){newW = this.resizingWin.maxW;ofs = this._carcass.x + this._carcass.w - this.resizingWin.maxW;}
 if ((newW < this.resizingWin.minW)&& (sign < 0)) {this._carcass.x = this._carcass.x + this._carcass.w - this.resizingWin.minW;this._carcass.w = this.resizingWin.minW;}else {this._carcass.w = newW;this._carcass.x = ofs;}
 this._carcass.style.left = this._carcass.x+"px";this._carcass.style.width = this._carcass.w+"px";}
 }
 
 if (this.resizingDirs == "border_right" || this.resizingDirs == "corner_right" || this.resizingDirs == "corner_up_right"){if (this._effects["resize"]){var ofs = xy.x - (this.resizingWin.x + this.resizingWin.w) + this.resizingWin.resizeOffsetXW;newW = this.resizingWin.w + ofs;if (newW < this.resizingWin.minW){newW = this.resizingWin.minW;}
 this.resizingWin.w = newW;this._engineRedrawWindowPos(this.resizingWin);this._engineRedrawWindowSize(this.resizingWin);}else {var ofs = xy.x - (this._carcass.x + this._carcass.w) + this.resizingWin.resizeOffsetXW;newW = this._carcass.w + ofs;if (newW < this.resizingWin.minW)newW = this.resizingWin.minW;if (this.resizingWin.maxW != "auto")if (newW > this.resizingWin.maxW)newW = this.resizingWin.maxW;this._carcass.w = newW;this._carcass.style.width = this._carcass.w+"px";}
 }
 
 if (this.resizingDirs == "border_bottom" || this.resizingDirs == "corner_left" || this.resizingDirs == "corner_right"){if (this._effects["resize"]){var ofs = xy.y - (this.resizingWin.y + this.resizingWin.h) + this.resizingWin.resizeOffsetYH;newH = this.resizingWin.h + ofs;if (newH < this.resizingWin.minH)newH = this.resizingWin.minH;this.resizingWin.h = newH;this._engineRedrawWindowPos(this.resizingWin);this._engineRedrawWindowSize(this.resizingWin);}else {var ofs = xy.y - (this._carcass.y + this._carcass.h) + this.resizingWin.resizeOffsetYH;newH = this._carcass.h + ofs;if (newH < this.resizingWin.minH)newH = this.resizingWin.minH;if (newH > this.resizingWin.maxH)newH = this.resizingWin.maxH;this._carcass.h = newH;this._carcass.style.height = this._carcass.h+"px";}
 }
 if (this.resizingDirs == "border_top" || this.resizingDirs == "corner_up_right" || this.resizingDirs == "corner_up_left"){if (this._effects["resize"]){}else {var ofs = xy.y + this.resizingWin.resizeOffsetY;var sign = (ofs > this.resizingWin.y ? -1 : 1);newH = this.resizingWin.h + Math.abs(ofs - this.resizingWin.y)*sign;if (newH > this.resizingWin.maxH){newH = this.resizingWin.maxH;ofs = this.resizingWin.y + this.resizingWin.h - this.resizingWin.maxH;}
 if ((newH < this.resizingWin.minH)&& (sign < 0)) {this._carcass.y = this._carcass.y + this._carcass.h - this.resizingWin.minH;this._carcass.h = this.resizingWin.minH;}else {this._carcass.h = newH+(_isIE?0:-2);this._carcass.y = ofs;}
 this._carcass.style.top = this._carcass.y+"px";this._carcass.style.height = this._carcass.h+"px";}
 }
 }
 }
 
 this._stopMove = function() {if (this.movingWin != null){if (this._effects["move"]){var win = this.movingWin;this.movingWin = null;this._blockSwitcher(false);this._engineGetWindowHeader(win).style.cursor = "";if (_isFF){win.h++;that._engineRedrawWindowPos(win);win.h--;that._engineRedrawWindowPos(win);}
 }else {this._carcass.style.cursor = "";this._carcass.style.display = "none";var win = this.movingWin;this._engineGetWindowHeader(win).style.cursor = "";this.movingWin = null;this._blockSwitcher(false);win.setPosition(parseInt(this._carcass.style.left), parseInt(this._carcass.style.top));}
 
 this._vpcover.style.display = "none";if (this._wasMoved){if (win.checkEvent("onMoveFinish")) {win.callEvent("onMoveFinish",[win]);}else {this.callEvent("onMoveFinish",[win]);}
 }
 this._wasMoved = false;}
 if (this.resizingWin != null){var win = this.resizingWin;this.resizingWin = null;this._blockSwitcher(false);if (!this._effects["resize"]){this._carcass.style.display = "none";win.setDimension(this._carcass.w+(_isIE?0:2), this._carcass.h+(_isIE?0:2));win.setPosition(this._carcass.x, this._carcass.y);}else {win.updateNestedObjects();}
 
 if (win.vs[win.av].layout){win.vs[win.av].layout.callEvent("onResize", []);}
 
 
 
 this._vpcover.style.display = "none";if (win.checkEvent("onResizeFinish")) {win.callEvent("onResizeFinish",[win]);}else {this.callEvent("onResizeFinish",[win]);}
 }
 }
 
 
 
 
 
 this._fixWindowDimensionInViewport = function(win) {if (win.w < win.minW){win.w = win.minW;}
 if (win._isParked)return;if (win.h < win.minH){win.h = win.minH;}
 }
 
 this._bringOnTop = function(win) {var cZIndex = win.zi;var topZIndex = this._getTopZIndex(win._isSticked);for (var a in this.wins){if (this.wins[a] != win){if (win._isSticked || (!win._isSticked && !this.wins[a]._isSticked)) {if (this.wins[a].zi > cZIndex){this.wins[a].zi = this.wins[a].zi - this.zIndexStep;this.wins[a].style.zIndex = this.wins[a].zi;}
 }
 }
 }
 win.zi = topZIndex;win.style.zIndex = win.zi;}
 
 this._makeActive = function(win, ignoreFocusEvent) {for (var a in this.wins){if (this.wins[a] == win){var needEvent = false;if (this.wins[a].className != "dhtmlx_window_active" && !ignoreFocusEvent){needEvent = true;}
 this.wins[a].className = "dhtmlx_window_active";this._engineUpdateWindowIcon(this.wins[a], this.wins[a].icons[0]);if (needEvent == true){if (win.checkEvent("onFocus")) {win.callEvent("onFocus",[win]);}else {this.callEvent("onFocus",[win]);}
 }
 }else {this.wins[a].className = "dhtmlx_window_inactive";this._engineUpdateWindowIcon(this.wins[a], this.wins[a].icons[1]);}
 }
 }
 
 this._getActive = function() {var win = null;for (var a in this.wins){if (this.wins[a].className == "dhtmlx_window_active"){win = this.wins[a];}
 }
 return win;}
 
 this._centerWindow = function(win, onScreen) {if (win._isMaximized == true)return;if (onScreen == true){var vpw = (_isIE?document.body.offsetWidth:window.innerWidth);var vph = (_isIE?document.body.offsetHeight:window.innerHeight);}else {var vpw = (this.vp==document.body?document.body.offsetWidth:(Number(parseInt(this.vp.style.width))&&String(this.vp.style.width).search("%")==-1?parseInt(this.vp.style.width):this.vp.offsetWidth));var vph = (this.vp==document.body?document.body.offsetHeight:(Number(parseInt(this.vp.style.height))&&String(this.vp.style.height).search("%")==-1?parseInt(this.vp.style.height):this.vp.offsetHeight));}
 var newX = Math.round((vpw/2) - (win.w/2));var newY = Math.round((vph/2) - (win.h/2));win.x = newX;win.y = newY;this._engineFixWindowPosInViewport(win);this._engineRedrawWindowPos(win);}
 
 this._addDefaultButtons = function(winId) {var win = this.wins[winId];var btnStick = this._engineGetWindowButton(win, "stick");btnStick.title = this.i18n.stick;btnStick.isVisible = false;btnStick.style.display = "none";btnStick._isEnabled = true;btnStick.isPressed = false;btnStick.label = "stick";btnStick._doOnClick = function() {this.isPressed = true;that._stickWindow(this.winId);}
 
 
 var btnSticked = this._engineGetWindowButton(win, "sticked");btnSticked.title = this.i18n.unstick;btnSticked.isVisible = false;btnSticked.style.display = "none";btnSticked._isEnabled = true;btnSticked.isPressed = false;btnSticked.label = "sticked";btnSticked._doOnClick = function() {this.isPressed = false;that._unstickWindow(this.winId);}
 
 
 var btnHelp = this._engineGetWindowButton(win, "help");btnHelp.title = this.i18n.help;btnHelp.isVisible = false;btnHelp.style.display = "none";btnHelp._isEnabled = true;btnHelp.isPressed = false;btnHelp.label = "help";btnHelp._doOnClick = function() {that._needHelp(this.winId);}
 
 
 var btnPark = this._engineGetWindowButton(win, "park");btnPark.titleIfParked = this.i18n.parkdown;btnPark.titleIfNotParked = this.i18n.parkup;btnPark.title = btnPark.titleIfNotParked;btnPark.isVisible = true;btnPark._isEnabled = true;btnPark.isPressed = false;btnPark.label = "park";btnPark._doOnClick = function() {that._parkWindow(this.winId);}
 
 
 var btnMinMax1 = this._engineGetWindowButton(win, "minmax1");btnMinMax1.title = this.i18n.maximize;btnMinMax1.isVisible = true;btnMinMax1._isEnabled = true;btnMinMax1.isPressed = false;btnMinMax1.label = "minmax1";btnMinMax1._doOnClick = function() {that._maximizeWindow(this.winId);}
 
 
 var btnMinMax2 = this._engineGetWindowButton(win, "minmax2");btnMinMax2.title = this.i18n.restore;btnMinMax2.isVisible = false;btnMinMax2.style.display = "none";btnMinMax2._isEnabled = true;btnMinMax2.isPressed = false;btnMinMax2.label = "minmax2";btnMinMax2._doOnClick = function() {that._restoreWindow(this.winId);}
 
 
 var btnClose = this._engineGetWindowButton(win, "close");btnClose.title = this.i18n.close;btnClose.isVisible = true;btnClose._isEnabled = true;btnClose.isPressed = false;btnClose.label = "close";btnClose._doOnClick = function() {that._closeWindow(this.winId);}
 
 
 var btnDock = this._engineGetWindowButton(win, "dock");btnDock.title = this.i18n.dock;btnDock.style.display = "none";btnDock.isVisible = false;btnDock._isEnabled = true;btnDock.isPressed = false;btnDock.label = "dock";btnDock._doOnClick = function() {}
 
 
 win._isSticked = false;win._isParked = false;win._isParkedAllowed = true;win._isMaximized = false;win._isDocked = false;win.btns = {};win.btns["stick"] = btnStick;win.btns["sticked"] = btnSticked;win.btns["help"] = btnHelp;win.btns["park"] = btnPark;win.btns["minmax1"] = btnMinMax1;win.btns["minmax2"] = btnMinMax2;win.btns["close"] = btnClose;win.btns["dock"] = btnDock;for (var a in win.btns){win.btns[a].winId = win.idd;this._attachEventsOnButton(win.idd, a);}
 
 win = btnStick = btnSticked = btnHelp = btnPark = btnMinMax1 = btnMinMax2 = btnClose = btnDock = null;}
 this._attachEventsOnButton = function(winId, btnId) {var btn = this.wins[winId].btns[btnId];if (!this._isIPad){btn.onmouseover = function() {if (this._isEnabled){this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_over_"+(this.isPressed?"pressed":"default");}else {this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_disabled";}
 }
 btn.onmouseout = function() {if (this._isEnabled){this.isPressed = false;this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_default";}else {this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_disabled";}
 }
 btn.onmousedown = function() {if (this._isEnabled){this.isPressed = true;this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_over_pressed";}else {this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_disabled";}
 }
 btn.onmouseup = function() {if (this._isEnabled){var wasPressed = this.isPressed;this.isPressed = false;this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_over_default";if (wasPressed){if (this.checkEvent("onClick")) {this.callEvent("onClick", [that.wins[this.winId], this]);}else {this._doOnClick();}
 }
 }else {this.className = "dhtmlx_wins_btns_button dhtmlx_button_"+this.label+"_disabled";}
 }
 
 }else {btn.ontouchstart = function(e) {e.cancelBubble = true;e.returnValue = false;return false;}
 btn.ontouchend = function(e) {e.cancelBubble = true;e.returnValue = false;if (!this._isEnabled)return false;if (this.checkEvent("onClick")) {this.callEvent("onClick", [that.wins[this.winId], this]);}else {this._doOnClick();}
 
 
 return false;}
 
 }
 

 btn.show = function() {that._showButton(that.wins[this.winId], this.label, true);}
 btn.hide = function() {that._hideButton(that.wins[this.winId], this.label, true);}
 btn.enable = function() {that._enableButton(that.wins[this.winId], this.label);}
 btn.disable = function() {that._disableButton(that.wins[this.winId], this.label);}
 btn.isEnabled = function() {return this._isEnabled;}
 btn.isHidden = function() {return (!this.isVisible);}
 
 dhtmlxEventable(btn);btn = null;}
 this._parkWindow = function(winId, parkBeforeMinMax) {var win = this.wins[winId];if (!win._isParkedAllowed && !parkBeforeMinMax)return;if (this.enableParkEffect && win.parkBusy)return;if (win._isParked){if (this.enableParkEffect && !parkBeforeMinMax){win.parkBusy = true;this._doParkDown(win);}else {win.h = win.lastParkH;this._engineRedrawWindowSize(win);this._engineDoOnWindowParkDown(win);win.updateNestedObjects();win.btns["park"].title = win.btns["park"].titleIfNotParked;if (win._allowResizeGlobal == true){this._enableButton(win, "minmax1");this._enableButton(win, "minmax2");}
 win._isParked = false;if (!parkBeforeMinMax)if (win.checkEvent("onParkDown")) win.callEvent("onParkDown", [win]);else this.callEvent("onParkDown", [win]);}
 }else {if (this.enableParkEffect && !parkBeforeMinMax){win.lastParkH = (String(win.h).search(/\%$/)==-1?win.h:win.offsetHeight);if (win._allowResizeGlobal == true){this._disableButton(win, "minmax1");this._disableButton(win, "minmax2");}
 if (this.enableParkEffect){win.parkBusy = true;this._doParkUp(win);}else {var skinParams = (win._skinParams!=null?win._skinParams:this.skinParams[this.skin]);win.h = skinParams["header_height"] + skinParams["border_bottom_height"];win.btns["park"].title = win.btns["park"].titleIfParked;}
 }else {win.lastParkH = (String(win.h).search(/\%$/)==-1?win.h:win.offsetHeight);win.h = this._engineGetWindowParkedHeight(win);this._engineRedrawWindowSize(win);this._engineDoOnWindowParkUp(win);win.btns["park"].title = win.btns["park"].titleIfParked;win._isParked = true;if (!parkBeforeMinMax)if (win.checkEvent("onParkUp")) win.callEvent("onParkUp", [win]);else this.callEvent("onParkUp", [win]);}
 }
 win = null;}
 
 this._allowParking = function(win) {win._isParkedAllowed = true;this._enableButton(win, "park");}
 this._denyParking = function(win) {win._isParkedAllowed = false;this._disableButton(win, "park");}
 
 
 this.enableParkEffect = false;this.parkStartSpeed = 80;this.parkSpeed = this.parkStartSpeed;this.parkTM = null;this.parkTMTime = 5;this._doParkUp = function(win) {if (String(win.h).search(/\%$/) != -1) {win.h = win.offsetHeight;}
 win.h -= this.parkSpeed;var hh = this._engineGetWindowParkedHeight(win);if (win.h <= hh){win.h = hh;this._engineGetWindowButton(win, "park").title = this._engineGetWindowButton(win, "park").titleIfParked;win._isParked = true;win.parkBusy = false;this._engineRedrawWindowSize(win);this._engineDoOnWindowParkUp(win);if (win.checkEvent("onParkUp")) win.callEvent("onParkUp", [win]);else this.callEvent("onParkUp", [win]);}else {this._engineRedrawWindowSize(win);this.parkTM = window.setTimeout(function(){that._doParkUp(win);}, this.parkTMTime);}
 }
 
 this._doParkDown = function(win) {win.h += this.parkSpeed;if (win.h >= win.lastParkH){win.h = win.lastParkH;this._engineGetWindowButton(win, "park").title = this._engineGetWindowButton(win, "park").titleIfNotParked;if (win._allowResizeGlobal == true){this._enableButton(win, "minmax1");this._enableButton(win, "minmax2");}
 win._isParked = false;win.parkBusy = false;this._engineRedrawWindowSize(win);win.updateNestedObjects();this._engineDoOnWindowParkDown(win);if (win.checkEvent("onParkDown")) win.callEvent("onParkDown", [win]);else this.callEvent("onParkDown", [win]);}else {this._engineRedrawWindowSize(win);this.parkTM = window.setTimeout(function(){that._doParkDown(win);}, this.parkTMTime);}
 }
 this._enableButton = function(win, btn) {var button = this._engineGetWindowButton(win, btn);if (!button)return;button._isEnabled = true;button.className = "dhtmlx_wins_btns_button dhtmlx_button_"+button.label+"_default";button = null;}
 
 this._disableButton = function(win, btn) {var button = this._engineGetWindowButton(win, btn);if (!button)return;button._isEnabled = false;button.className = "dhtmlx_wins_btns_button dhtmlx_button_"+win.btns[btn].label+"_disabled";button = null;}
 
 this._allowReszieGlob = function(win) {win._allowResizeGlobal = true;this._enableButton(win, "minmax1");this._enableButton(win, "minmax2");}
 
 this._denyResize = function(win) {win._allowResizeGlobal = false;this._disableButton(win, "minmax1");this._disableButton(win, "minmax2");}
 
 this._maximizeWindow = function(winId) {var win = this.wins[winId];if (win._allowResizeGlobal == false)return;var isParkedBeforeMinMax = win._isParked;if (isParkedBeforeMinMax)this._parkWindow(win.idd, true);win.lastMaximizeX = win.x;win.lastMaximizeY = win.y;win.lastMaximizeW = win.w;win.lastMaximizeH = win.h;if (win.maxW != "auto" && win.maxW != "auto"){win.x = Math.round(win.x+(win.w-win.maxW)/2);win.y = Math.round(win.y+(win.h-win.maxH)/2);win._allowMove = true;}else {win.x = 0;win.y = 0;win._allowMove = false;}
 win._isMaximized = true;win._allowResize = false;win.w = (win.maxW == "auto" ? (this.vp == document.body ? "100%" : (this.vp.style.width != "" && String(this.vp.style.width).search("%") == -1 ? parseInt(this.vp.style.width) : this.vp.offsetWidth)) : win.maxW);win.h = (win.maxH == "auto" ? (this.vp == document.body ? "100%" : (this.vp.style.height != "" && String(this.vp.style.width).search("%") == -1 ? parseInt(this.vp.style.height) : this.vp.offsetHeight)) : win.maxH);this._hideButton(win, "minmax1");this._showButton(win, "minmax2");this._engineRedrawWindowPos(win);if (isParkedBeforeMinMax){this._parkWindow(win.idd, true);}else {this._engineRedrawWindowSize(win);win.updateNestedObjects();}
 
 if (win.checkEvent("onMaximize")) win.callEvent("onMaximize", [win]);else this.callEvent("onMaximize", [win]);win = null;}
 
 this._restoreWindow = function(winId) {var win = this.wins[winId];if (win._allowResizeGlobal == false)return;if (win.layout)win.layout._defineWindowMinDimension(win);var isParkedBeforeMinMax = win._isParked;if (isParkedBeforeMinMax)this._parkWindow(win.idd, true);if (win.maxW != "auto" && win.maxW != "auto"){win.x = Math.round(win.x+(win.w-win.lastMaximizeW)/2);win.y = Math.round(win.y+(win.h-win.lastMaximizeH)/2);}else {win.x = win.lastMaximizeX;win.y = win.lastMaximizeY;}
 win.w = win.lastMaximizeW;win.h = win.lastMaximizeH;win._isMaximized = false;win._allowMove = win._allowMoveGlobal;win._allowResize = true;this._fixWindowDimensionInViewport(win);this._hideButton(win, "minmax2");this._showButton(win, "minmax1");this._engineRedrawWindowPos(win);if (isParkedBeforeMinMax){this._parkWindow(win.idd, true);}else {this._engineRedrawWindowSize(win);win.updateNestedObjects();}
 
 if (win.checkEvent("onMinimize")) win.callEvent("onMinimize", [win]);else this.callEvent("onMinimize", [win]);win = null;}
 this._showButton = function(win, btn, userShow) {var button = this._engineGetWindowButton(win, btn);if (!button)return;if ((!userShow && button._userHide)|| button.isVisible === true) return;button.isVisible = true;button.style.display = "";button.style.visibility = "visible";button._userHide = !(userShow==true);this._engineRedrawWindowTitle(win);button = null;}
 
 this._hideButton = function(win, btn, userHide) {var button = this._engineGetWindowButton(win, btn);if (!button || (!userHide && button.isVisible === false)) return;button.isVisible = false;button.style.display = "none";button.style.visibility = "hidden";button._userHide = (userHide==true);this._engineRedrawWindowTitle(win);button = null;}
 this._showWindow = function(win) {win.style.display = "";if (win.checkEvent("onShow")) {win.callEvent("onShow", [win]);}else {this.callEvent("onShow", [win]);}
 
 var w = this._getActive();if (w == null){this._bringOnTop(win);this._makeActive(win);}else if (this._isWindowHidden(w)) {this._bringOnTop(win);this._makeActive(win);}
 }
 
 this._hideWindow = function(win) {win.style.display = "none";if (win.checkEvent("onHide")) {win.callEvent("onHide", [win]);}else {this.callEvent("onHide", [win]);}
 
 var w = this.getTopmostWindow(true);if (w != null){this._bringOnTop(w);this._makeActive(w);}
 }
 
 this._isWindowHidden = function(win) {var isHidden = (win.style.display == "none");return isHidden;}
 
 this._closeWindow = function(winId) {var win = this.wins[winId];if (this._focusFixIE){this._focusFixIE.style.top = (this.vp==document.body?0:getAbsoluteTop(this.vp))+Number(win.y)+"px";this._focusFixIE.focus();}
 
 
 if (win.checkEvent("onClose")) {if (!win.callEvent("onClose", [win])) return;}else {if(!this.callEvent("onClose", [win])) return;}
 
 
 
 
 win = null;this._removeWindowGlobal(winId);var latest = {"zi": 0 };for (var a in this.wins){if (this.wins[a].zi > latest.zi){latest = this.wins[a];}}
 if (latest != null){this._makeActive(latest);}
 
 
 }
 
 this._needHelp = function(winId) {var win = this.wins[winId];if (win.checkEvent("onHelp")) {win.callEvent("onHelp", [win]);}else {this.callEvent("onHelp", [win]);}
 win = null;}
 this._setWindowIcon = function(win, iconEnabled, iconDisabled) {win.iconsPresent = true;win.icons[0] = this.imagePath + iconEnabled;win.icons[1] = this.imagePath + iconDisabled;this._engineUpdateWindowIcon(win, win.icons[win.isOnTop()?0:1]);}
 
 this._getWindowIcon = function(win) {if (win.iconsPresent){return new Array(win.icons[0], win.icons[1]);}else {return new Array(null, null);}
 }
 
 this._clearWindowIcons = function(win) {win.iconsPresent = false;win.icons[0] = this.imagePath + this.pathPrefix + this.skin + "/active/icon_blank.gif";win.icons[1] = this.imagePath + this.pathPrefix + this.skin + "/inactive/icon_blank.gif";this._engineUpdateWindowIcon(win, win.icons[win.isOnTop()?0:1]);}
 
 this._restoreWindowIcons = function(win) {win.iconsPresent = true;win.icons[0] = this.imagePath + this.pathPrefix + this.skin + "/active/icon_normal.gif";win.icons[1] = this.imagePath + this.pathPrefix + this.skin + "/inactive/icon_normal.gif";this._engineUpdateWindowIcon(win, win.icons[win.className=="dhtmlx_window_active"?0:1]);}
 
 this._attachWindowContentTo = function(win, obj, w, h) {var data = this._engineGetWindowContent(win).parentNode;data.parentNode.removeChild(data);win.hide();data.style.left = "0px";data.style.top = "0px";data.style.width = (w!=null?w:obj.offsetWidth)+"px";data.style.height = (h!=null?h:obj.offsetHeight)+"px";data.style.position = "relative";obj.appendChild(data);this._engineGetWindowContent(win).style.width = data.style.width;this._engineGetWindowContent(win).style.height = data.style.height;}
 
 this._setWindowToFullScreen = function(win, state) {if (state == true){var data = win._content;data.parentNode.removeChild(data);win.hide();win._isFullScreened = true;data.style.left = "0px";data.style.top = "0px";data.style.width = document.body.offsetWidth-(_isIE?4:0)+"px";if (document.body.offsetHeight == 0){if (window.innerHeight){data.style.height = window.innerHeight+"px";}else {data.style.height = document.body.scrollHeight+"px";}
 }else {data.style.height = document.body.offsetHeight-(_isIE?4:0)+"px";}
 
 data.style.position = "absolute";document.body.appendChild(data);}else if (state == false){var data = win.childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1];var base = win._content;document.body.removeChild(base);data.appendChild(base);win._isFullScreened = false;win.setDimension(win.w, win.h);win.show();win.bringToTop();win.center();}
 win.updateNestedObjects();}
 
 this._isWindowOnTop = function(win) {var state = (this.getTopmostWindow() == win);return state;}
 
 this._bringOnBottom = function(win) {for (var a in this.wins){if (this.wins[a].zi < win.zi){this.wins[a].zi += this.zIndexStep;this.wins[a].style.zIndex = this.wins[a].zi;}
 }
 win.zi = 50;win.style.zIndex = win.zi;this._makeActive(this.getTopmostWindow());}
 
 this._isWindowOnBottom = function(win) {var state = true;for (var a in this.wins){if (this.wins[a] != win){state = state && (this.wins[a].zi > win.zi);}
 }
 return state;}
 
 this._stickWindow = function(winId) {var win = this.wins[winId];win._isSticked = true;this._hideButton(win, "stick");this._showButton(win, "sticked");this._bringOnTop(win);win = null;}
 
 this._unstickWindow = function(winId) {var win = this.wins[winId];win._isSticked = false;this._hideButton(win, "sticked");this._showButton(win, "stick");this._bringOnTopAnyStickedWindows();win = null;}
 
 this._addUserButton = function(win, id, pos, title) {id = String(id).toLowerCase();var userButton = this._engineAddUserButton(win, id, pos);userButton.title = title;userButton.isVisible = true;userButton._isEnabled = true;userButton.isPressed = false;userButton.label = id;win.btns[id] = userButton;win.btns[id].winId = win.idd
 win.btns[id]._doOnClick = function(){};this._attachEventsOnButton(win.idd, id);userButton = null;}
 
 
 this._removeUserButton = function(win, buttonId) {this._removeButtonGlobal(win, buttonId);}
 
 this._blockSwitcher = function(state) {for (var a in this.wins){if (state == true){this.wins[a].showCoverBlocker();}else {this.wins[a].hideCoverBlocker();}
 }
 }
 
 this.resizingWin = null;this.modalWin = null;this.resizingDirs = "none";if (_isIE){this._focusFixIE = document.createElement("INPUT");this._focusFixIE.className = "dhx_windows_ieonclosefocusfix";this._focusFixIE.style.position = "absolute";this._focusFixIE.style.width = "1px";this._focusFixIE.style.height = "1px";this._focusFixIE.style.border = "none";this._focusFixIE.style.background = "none";this._focusFixIE.style.left = "-10px";this._focusFixIE.style.fontSize = "1px";document.body.appendChild(this._focusFixIE);}
 
 this._createViewport();this._doOnMouseUp = function() {if (that != null)that._stopMove();}
 this._doOnMoseMove = function(e) {e = e||event;if (that != null)that._moveWindow(e);}
 this._resizeTM = null;this._resizeTMTime = 200;this._lw = null;this._doOnResize = function() {if (that._lw != document.documentElement.clientHeight){window.clearTimeout(that._resizeTM);that._resizeTM = window.setTimeout(function(){that._autoResizeViewport();}, that._resizeTMTime);}
 that._lw = document.documentElement.clientHeight;}
 this._doOnUnload = function() {that.unload();}
 this._doOnSelectStart = function(e) {e = e||event;if (that.movingWin != null || that.resizingWin != null)e.returnValue = false;}
 if (_isIE){document.body.attachEvent("onselectstart", this._doOnSelectStart);}
 
 dhtmlxEvent(window, "resize", this._doOnResize);dhtmlxEvent(document.body, "unload", this._doOnUnload);if (this._isIPad){document.addEventListener("touchmove", this._doOnMoseMove, false);document.addEventListener("touchend", this._doOnMouseUp, false);}else {dhtmlxEvent(document.body, "mouseup", this._doOnMouseUp);dhtmlxEvent(this.vp, "mousemove", this._doOnMoseMove);dhtmlxEvent(this.vp, "mouseup", this._doOnMouseUp);}
 
 
 this._setWindowModal = function(win, state) {if (state == true){this._makeActive(win);this._bringOnTop(win);this.modalWin = win;win._isModal = true;this.modalCoverI.style.zIndex = win.zi - 2;this.modalCoverI.style.display = "";this.modalCoverD.style.zIndex = win.zi - 2;this.modalCoverD.style.display = "";}else {this.modalWin = null;win._isModal = false;this.modalCoverI.style.zIndex = 0;this.modalCoverI.style.display = "none";this.modalCoverD.style.zIndex = 0;this.modalCoverD.style.display = "none";}
 }
 
 this._bringOnTopAnyStickedWindows = function() {var wins = new Array();for (var a in this.wins){if (this.wins[a]._isSticked){wins[wins.length] = this.wins[a];}}
 for (var q=0;q<wins.length;q++){this._bringOnTop(wins[q]);}
 
 if (wins.length == 0){for (var a in this.wins){if (this.wins[a].className == "dhtmlx_window_active"){this._bringOnTop(this.wins[a]);}
 }
 }
 }
 
 
 this.unload = function() {this._clearAll();}
 
 this._removeButtonGlobal = function(winId, buttonId) {if (!this.wins[winId])return;if (!this.wins[winId].btns[buttonId])return;var btn = this.wins[winId].btns[buttonId];btn.title = null;btn.isVisible = null;btn._isEnabled = null;btn.isPressed = null;btn.label = null;btn._doOnClick = null;btn.detachAllEvents();btn.attachEvent = null;btn.callEvent = null;btn.checkEvent = null;btn.detachEvent = null;btn.detachAllEvents = null;btn.disable = null;btn.enable = null;btn.eventCatcher = null;btn.hide = null;btn.isEnabled = null;btn.isHidden = null;btn.show = null;btn.onmousedown = null;btn.onmouseout = null;btn.onmouseover = null;btn.onmouseup = null;btn.ontouchstart = null;btn.ontouchend = null;if (btn.parentNode)btn.parentNode.removeChild(btn);btn = null;this.wins[winId].btns[buttonId] = null;delete this.wins[winId].btns[buttonId];}
 
 
 this._removeWindowGlobal = function(winId) {var win = this.wins[winId];if (this.modalWin == win)this._setWindowModal(win, false);var t = win.coverBlocker();t.onselectstart = null;t = null;this._engineDiableOnSelectInWindow(win, false);win._dhxContDestruct();this._engineGetWindowHeader(win).onmousedown = null;this._engineGetWindowHeader(win).ondblclick = null;this.movingWin = null;this.resizingWin = null;for (var a in win.btns)this._removeButtonGlobal(win, a);win.btns = null;win.detachAllEvents();win._adjustToContent = null;win._doOnAttachMenu = null;win._doOnAttachStatusBar = null;win._doOnAttachToolbar = null;win._doOnFrameMouseDown = null;win._doOnFrameContentLoaded = null;win._redraw = null;win.addUserButton = null;win.allowMove = null;win.allowPark = null;win.allowResize = null;win.attachEvent = null;win.bringToBottom = null;win.bringToTop = null;win.callEvent = null;win.center = null;win.centerOnScreen = null;win.checkEvent = null;win.clearIcon = null;win.close = null;win.denyMove = null;win.denyPark = null;win.denyResize = null;win.detachEvent = null;win.detachAllEvents = null;win.eventCatcher = null;win.getDimension = null;win.getIcon = null;win.getId = null;win.getMaxDimension = null;win.getMinDimension = null;win.getPosition = null;win.getText = null;win.hide = null;win.hideHeader = null;win.isHidden = null;win.isMaximized = null;win.isModal = null;win.isMovable = null;win.isOnBottom = null;win.isOnTop = null;win.isParkable = null;win.isParked = null;win.isResizable = null;win.isSticked = null;win.keepInViewport = null;win.maximize = null;win.minimize = null;win.park = null;win.progressOff = null;win.progressOn = null;win.removeUserButton = null;win.restoreIcon = null;win.setDimension = null;win.setIcon = null;win.setMaxDimension = null;win.setMinDimension = null;win.setModal = null;win.setPosition = null;win.setText = null;win.setToFullScreen = null;win.show = null;win.showHeader = null;win.stick = null;win.unstick = null;win.onmousemove = null;win.onmousedown = null;win.icons = null;win.button = null;win._dhxContDestruct = null;win.dhxContGlobal.obj = null;win.dhxContGlobal.setContent = null;win.dhxContGlobal.dhxcont = null;win.dhxContGlobal = null;if (win._frame){while (win._frame.childNodes.length > 0)win._frame.removeChild(win._frame.childNodes[0]);win._frame = null;}
 
 
 this._parseNestedForEvents(win);win._content = null;win.innerHTML = "";win.parentNode.removeChild(win);win = null;this.wins[winId] = null;delete this.wins[winId];}
 
 this._removeEvents = function(obj) {obj.onmouseover = null;obj.onmouseout = null;obj.onmousemove = null;obj.onclick = null;obj.ondblclick = null;obj.onmouseenter = null;obj.onmouseleave = null;obj.onmouseup = null;obj.onmousewheel = null;obj.onmousedown = null;obj.onselectstart = null;obj.onfocus = null;obj.style.display = "";obj = null;}
 this._parseNestedForEvents = function(obj) {this._removeEvents(obj);for (var q=0;q<obj.childNodes.length;q++){if (obj.childNodes[q].tagName != null){this._parseNestedForEvents(obj.childNodes[q]);}
 }
 obj = null;}
 
 this._clearAll = function() {this._clearDocumentEvents();for (var a in this.wins)this._removeWindowGlobal(a);this.wins = null;this._parseNestedForEvents(this._carcass);while (this._carcass.childNodes.length > 0)this._carcass.removeChild(this._carcass.childNodes[0]);this._carcass.onselectstart = null;this._carcass.parentNode.removeChild(this._carcass);this._carcass = null;this._parseNestedForEvents(this._vpcover);this._vpcover.parentNode.removeChild(this._vpcover);this._vpcover = null;this._parseNestedForEvents(this.modalCoverD);this.modalCoverD.parentNode.removeChild(this.modalCoverD);this.modalCoverD = null;this._parseNestedForEvents(this.modalCoverI);this.modalCoverI.parentNode.removeChild(this.modalCoverI);this.modalCoverI = null;if (this.vp.autocreated == true)this.vp.parentNode.removeChild(this.vp);this.vp = null;for (var a in this.skinParams){delete this.skinParams[a];}
 this.skinParams = null;this._effects = null;this._engineSkinParams = null;this._addDefaultButtons = null;this._addUserButton = null;this._allowParking = null;this._allowReszieGlob = null;this._attachEventsOnButton = null;this._attachWindowContentTo = null;this._autoResizeViewport = null;this._blockSwitcher = null;this._bringOnBottom = null;this._bringOnTop = null;this._bringOnTopAnyStickedWindows = null;this._centerWindow = null;this._clearAll = null;this._clearDocumentEvents = null;this._clearWindowIcons = null;this._closeWindow = null;this._createViewport = null;this._denyParking = null;this._denyResize = null;this._dhx_Engine = null;this._disableButton = null;this._doOnMoseMove = null;this._doOnMouseUp = null;this._doOnResize = null;this._doOnSelectStart = null;this._doOnUnload = null;this._doParkDown = null;this._doParkUp = null;this._enableButton = null;this._engineAddUserButton = null;this._engineAdjustWindowToContent = null;this._engineAllowWindowResize = null;this._engineCheckHeaderMouseDown = null;this._engineDiableOnSelectInWindow = null;this._engineDoOnWindowParkDown = null;this._engineDoOnWindowParkUp = null;this._engineFixWindowPosInViewport = null;this._engineGetWindowButton = null;this._engineGetWindowContent = null;this._engineGetWindowHeader = null;this._engineGetWindowHeaderState = null;this._engineGetWindowLabel = null;this._engineGetWindowParkedHeight = null;this._engineRedrawSkin = null;this._engineRedrawWindowPos = null;this._engineRedrawWindowSize = null;this._engineRedrawWindowTitle = null;this._engineSetWindowBody = null;this._engineSwitchWindowHeader = null;this._engineSwitchWindowProgress = null;this._engineUpdateWindowIcon = null;this._fixWindowDimensionInViewport = null;this._genStr = null;this._getActive = null;this._getTopZIndex = null;this._getWindowIcon = null;this._hideButton = null;this._hideWindow = null;this._isWindowHidden = null;this._isWindowOnBottom = null;this._isWindowOnTop = null;this._makeActive = null;this._maximizeWindow = null;this._moveWindow = null;this._needHelp = null;this._parkWindow = null;this._parseNestedForEvents = null;this._removeButtonGlobal = null;this._removeEvents = null;this._removeUserButton = null;this._removeWindowGlobal = null;this._restoreWindow = null;this._restoreWindowIcons = null;this._setWindowIcon = null;this._setWindowModal = null;this._setWindowToFullScreen = null;this._showButton = null;this._showWindow = null;this._stickWindow = null;this._stopMove = null;this._unstickWindow = null;this.attachEvent = null;this.attachViewportTo = null;this.callEvent = null;this.checkEvent = null;this.createWindow = null;this.detachEvent = null;this.enableAutoViewport = null;this.eventCatcher = null;this.findByText = null;this.forEachWindow = null;this.getBottommostWindow = null;this.getEffect = null;this.getTopmostWindow = null;this.isWindow = null;this.setEffect = null;this.setImagePath = null;this.setSkin = null;this.setViewport = null;this.unload = null;this.window = null;that = null;}
 
 this._clearDocumentEvents = function() {if (_isIE){window.detachEvent("onresize", this._doOnResize);document.body.detachEvent("onselectstart", this._doOnSelectStart);document.body.detachEvent("onmouseup", this._doOnMouseUp);document.body.detachEvent("onunload", this._doOnUnload);this.vp.detachEvent("onmousemove", this._doOnMoseMove);this.vp.detachEvent("onmouseup", this._doOnMouseUp);}else {window.removeEventListener("resize", this._doOnResize, false);document.body.removeEventListener("mouseup", this._doOnMouseUp, false);document.body.removeEventListener("unload", this._doOnUnload, false);this.vp.removeEventListener("mousemove", this._doOnMoseMove, false);this.vp.removeEventListener("mouseup", this._doOnMouseUp, false);}
 }
 
 
 
 
 this._genStr = function(w) {var s = "";var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for (var q=0;q<w;q++)s += z.charAt(Math.round(Math.random() * (z.length-1)));return s;}
 
 dhtmlxEventable(this);return this;};dhtmlXWindows.prototype._dhx_Engine = function() {this._engineEnabled = true;this._engineName = "dhx";this._engineSkinParams = {dhx_blue: {"hh": 21, "lbw": 2, "rbw": 2, "lch": 2, "lcw": 14, "rch": 14, "rcw": 14, "bbh": 2, "mnh": 23, "tbh": 25, "sbh": 20, "noh_t": null, "noh_h": null},
 dhx_black: {"hh": 21, "lbw": 2, "rbw": 2, "lch": 2, "lcw": 14, "rch": 14, "rcw": 14, "bbh": 2, "mnh": 23, "tbh": 25, "sbh": 20, "noh_t": null, "noh_h": null},
 dhx_skyblue: {"hh": 29, "lbw": 2, "rbw": 2, "lch": 2, "lcw": 14, "rch": 14, "rcw": 14, "bbh": 2, "mnh": 23, "tbh": 25, "sbh": 20, "noh_t": 5, "noh_h": -10},
 dhx_web: {"hh": 27, "lbw": 5, "rbw": 5, "lch": 5, "lcw": 14, "rch": 14, "rcw": 14, "bbh": 5, "mnh": 23, "tbh": 25, "sbh": 20, "noh_t": 5, "noh_h": -10},
 dhx_terrace: {"hh": 37, "lbw": 5, "rbw": 5, "lch": 5, "lcw": 14, "rch": 14, "rcw": 14, "bbh": 5, "mnh": 23, "tbh": 25, "sbh": 20, "noh_t": 5, "noh_h": -10}
 };this._isIE6 = false;if (_isIE)this._isIE6 = (window.XMLHttpRequest==null?true:false);this._engineSetWindowBody = function(win) {win.innerHTML = "<div iswin='1' class='dhtmlx_wins_body_outer' style='position: relative;'>"+
 (this._isIE6?"<iframe src='javascript:false;' frameborder='0' class='dhtmlx_wins_ie6_cover_fix' onload='this.contentWindow.document.body.style.overflow=\"hidden\";'></iframe>":"")+
 "<div class='dhtmlx_wins_icon'></div>"+
 "<div class='dhtmlx_wins_progress'></div>"+
 "<div class='dhtmlx_wins_title'>dhtmlxWindow</div>"+
 "<div class='dhtmlx_wins_btns'>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_sticked_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_stick_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_help_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_park_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_minmax2_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_minmax1_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_close_default'></div>"+
 "<div class='dhtmlx_wins_btns_button dhtmlx_button_dock_default'></div>"+
 "</div>"+
 "<div class='dhtmlx_wins_body_inner'></div>"+
 "<div winResT='yes' class='dhtmlx_wins_resizer_t' style='display:none;'></div>"+
 "<div winResL='yes' class='dhtmlx_wins_resizer_l'></div>"+
 "<div winResR='yes' class='dhtmlx_wins_resizer_r'></div>"+
 "<div winResB='yes' class='dhtmlx_wins_resizer_b'></div>"+
 "<div class='white_line'></div>"+
 "<div class='white_line2'></div>"+
 "</div>";win.dhxContGlobal = new dhtmlXContainer(win);if (this.skin == "dhx_skyblue"){win.dhxContGlobal.obj._offsetWidth = -10;win.dhxContGlobal.obj._offsetHeight = -5;win.dhxContGlobal.obj._offsetLeft = 5;win.dhxContGlobal.obj._offsetHeightSaved = win.dhxContGlobal.obj._offsetHeight;}
 if (this.skin == "dhx_web"){win.dhxContGlobal.obj._offsetWidth = -10;win.dhxContGlobal.obj._offsetHeight = -5;win.dhxContGlobal.obj._offsetLeft = 5;win.dhxContGlobal.obj._offsetHeightSaved = win.dhxContGlobal.obj._offsetHeight;}
 win.skin = this.skin;win.dhxContGlobal.setContent(win.childNodes[0].childNodes[(this._isIE6?5:4)]);var t = win.coverBlocker();t.onselectstart = function(e) {e = e||event;e.returnValue = false;e.cancelBubble = true;}
 t = null;}
 
 
 this._engineDiableOnSelectInWindow = function(win, state) {var data = new Array();data[0] = win.childNodes[0].childNodes[(this._isIE6?1:0)];data[1] = win.childNodes[0].childNodes[(this._isIE6?2:1)];data[2] = win.childNodes[0].childNodes[(this._isIE6?3:2)];data[3] = win.childNodes[0].childNodes[(this._isIE6?4:3)];data[4] = win.childNodes[0].childNodes[(this._isIE6?6:5)];data[5] = win.childNodes[0].childNodes[(this._isIE6?7:6)];data[6] = win.childNodes[0].childNodes[(this._isIE6?8:7)];data[7] = win.childNodes[0].childNodes[(this._isIE6?9:8)];for (var q=0;q<data.length;q++){data[q].onselectstart = (state?function(e){e=e||event;e.returnValue=false;return false;}:null);data[q] = null;}
 data = null;}
 
 
 this._engineGetWindowHeader = function(win) {win.childNodes[0].idd = win.idd;return win.childNodes[0];}
 
 
 this._engineRedrawWindowSize = function(win) {win.style.width = (String(win.w).search("%")==-1?win.w+"px":win.w);win.style.height = (String(win.h).search("%")==-1?win.h+"px":win.h);var body = win.childNodes[0];body.style.width = win.clientWidth+"px";body.style.height = win.clientHeight+"px";if (body.offsetWidth > win.clientWidth){body.style.width = win.clientWidth*2-body.offsetWidth+"px";}
 if (body.offsetHeight > win.clientHeight){var px = win.clientHeight*2-body.offsetHeight;if (px < 0)px = 0;body.style.height = px+"px";}
 
 var hh = (win._noHeader==true?win._hdrSize:this._engineSkinParams[this.skin]["hh"]);this._engineRedrawWindowTitle(win);win.adjustContent(body, hh);}
 
 
 this._engineRedrawWindowPos = function(win) {if (win._isFullScreened)return;win.style.left = win.x + "px";win.style.top = win.y + "px";}
 
 
 this._engineFixWindowPosInViewport = function(win) {var hh = (win._noHeader==true?win._hdrSize:this._engineSkinParams[this.skin]["hh"]);if (win._keepInViewport){if (win.x < 0){win.x = 0;}
 if (win.x + win.w > this.vp.offsetWidth){win.x = this.vp.offsetWidth - win.w;}
 
 if (win.y + win.h > this.vp.offsetHeight){win.y = this.vp.offsetHeight - win.h;}
 if (win.y < 0){win.y = 0;}
 }else {if (win.y + hh > this.vp.offsetHeight){win.y = this.vp.offsetHeight - hh;}
 if (win.y < 0){win.y = 0;}
 if (win.x + win.w - 10 < 0){win.x = 10 - win.w;}
 if (win.x > this.vp.offsetWidth - 10){win.x = this.vp.offsetWidth - 10;}
 }
 
 }
 
 
 this._engineCheckHeaderMouseDown = function(win, ev) {if (this._isIPad){var x = ev.touches[0].clientX;var y = ev.touches[0].clientY;var obj = ev.target||ev.srcElement;if (obj == win.childNodes[0] || obj == win.childNodes[0].childNodes[0] || obj == win.childNodes[0].childNodes[2] || obj == win.childNodes[0].childNodes[3])return true;return false;}else {var x = (_isIE||_isOpera?ev.offsetX:ev.layerX);var y = (_isIE||_isOpera?ev.offsetY:ev.layerY);var obj = ev.target||ev.srcElement;}
 
 var hh = (win._noHeader==true?win._hdrSize:this._engineSkinParams[this.skin]["hh"]);if (y <= hh && (obj == win.childNodes[0] || obj == win.childNodes[0].childNodes[(this._isIE6?1:0)] || obj == win.childNodes[0].childNodes[(this._isIE6?3:2)] || obj == win.childNodes[0].childNodes[(this._isIE6?4:3)])) return true;return false;}
 
 
 this._engineGetWindowContent = function(win) {alert("_engineGetWindowContent");}
 
 
 this._engineGetWindowButton = function(win, buttonName) {buttonName = String(buttonName).toLowerCase();var buttonObj = null;var buttonStyle = "dhtmlx_button_"+buttonName+"_";for (var q=0;q<win.childNodes[0].childNodes[(this._isIE6?4:3)].childNodes.length;q++) {var buttonTemp = win.childNodes[0].childNodes[(this._isIE6?4:3)].childNodes[q];if (String(buttonTemp.className).search(buttonStyle) != -1) {buttonObj = buttonTemp;}
 buttonTemp = null;}
 return buttonObj;}
 
 
 this._engineAddUserButton = function(win, buttonName, buttonPos) {if (isNaN(buttonPos)) buttonPos = 0;var button = document.createElement("DIV");button.className = "dhtmlx_wins_btns_button dhtmlx_button_"+buttonName+"_default";var buttonPoly = win.childNodes[0].childNodes[(this._isIE6?4:3)];buttonPos = buttonPoly.childNodes.length - buttonPos;if (buttonPos < 0)buttonPos = 0;if (buttonPos >= buttonPoly.childNodes.length){buttonPoly.appendChild(button);}else {buttonPoly.insertBefore(button, buttonPoly.childNodes[buttonPos]);}
 this._engineRedrawWindowTitle(win);return button;}
 
 
 this._engineGetWindowParkedHeight = function(win) {return this._engineSkinParams[this.skin]["hh"]+1;}
 
 
 this._engineDoOnWindowParkDown = function(win) {win.childNodes[0].childNodes[(this._isIE6?6:5)].style.display = (win._noHeader==true?"":"none");win.childNodes[0].childNodes[(this._isIE6?7:6)].style.display = "";win.childNodes[0].childNodes[(this._isIE6?8:7)].style.display = "";win.childNodes[0].childNodes[(this._isIE6?9:8)].style.display = "";}
 
 
 this._engineDoOnWindowParkUp = function(win) {win.childNodes[0].childNodes[(this._isIE6?6:5)].style.display = "none";win.childNodes[0].childNodes[(this._isIE6?7:6)].style.display = "none";win.childNodes[0].childNodes[(this._isIE6?8:7)].style.display = "none";win.childNodes[0].childNodes[(this._isIE6?9:8)].style.display = "none";}
 
 
 this._engineUpdateWindowIcon = function(win, icon) {win.childNodes[0].childNodes[(this._isIE6?1:0)].style.backgroundImage = "url('"+icon+"')";}
 
 
 this._engineAllowWindowResize = function(win, targetObj, mouseX, mouseY) {if (!targetObj.getAttribute)return;var sk = this._engineSkinParams[this.skin];var hh = (win._noHeader==true?win._hdrSize:this._engineSkinParams[this.skin]["hh"]);if (targetObj.getAttribute("winResL")!= null) {if (targetObj.getAttribute("winResL")== "yes") {if (mouseY >= hh){if (mouseY >= win.h - sk["lch"])return "corner_left";if (mouseY <= sk["lch"] && win._noHeader == true)return "corner_up_left";return "border_left";}
 }
 }
 if (targetObj.getAttribute("winResR")!= null) {if (targetObj.getAttribute("winResR")== "yes") {if (mouseY >= hh){if (mouseY >= win.h - sk["rch"])return "corner_right";if (mouseY <= sk["rch"] && win._noHeader == true)return "corner_up_right";return "border_right";}
 }
 }
 if (targetObj.getAttribute("winResT")!= null) {if (targetObj.getAttribute("winResT")== "yes" && win._noHeader == true) {if (mouseX <= sk["lcw"])return "corner_up_left";if (mouseX >= win.w - sk["rcw"])return "corner_up_right";return "border_top";}
 }
 if (targetObj.getAttribute("winResB")!= null) {if (targetObj.getAttribute("winResB")== "yes") {if (mouseX <= sk["lcw"])return "corner_left";if (mouseX >= win.w - sk["rcw"])return "corner_right";return "border_bottom";}
 }
 return null;}
 
 
 this._engineAdjustWindowToContent = function(win, w, h) {var newW = w+win.w-win.vs[win.av].dhxcont.clientWidth;var newH = h+win.h-win.vs[win.av].dhxcont.clientHeight;win.setDimension(newW, newH);}
 
 
 this._engineRedrawSkin = function() {this.vp.className = (this.vp==document.body&&this.vp._css?this.vp._css+" ":"")+"dhtmlx_winviewport dhtmlx_skin_"+this.skin+(this._r?" dhx_wins_rtl":"");var sk = this._engineSkinParams[this.skin];for (var a in this.wins){if (this.skin == "dhx_skyblue"){this.wins[a].dhxContGlobal.obj._offsetTop = (this.wins[a]._noHeader?sk["noh_t"]:null);this.wins[a].dhxContGlobal.obj._offsetWidth = -10;this.wins[a].dhxContGlobal.obj._offsetHeight = (this.wins[a]._noHeader?sk["noh_h"]:-5);this.wins[a].dhxContGlobal.obj._offsetLeft = 5;this.wins[a].dhxContGlobal.obj._offsetHeightSaved = -5;}else {this.wins[a].dhxContGlobal.obj._offsetWidth = null;this.wins[a].dhxContGlobal.obj._offsetHeight = null;this.wins[a].dhxContGlobal.obj._offsetLeft = null;this.wins[a].dhxContGlobal.obj._offsetTop = null;this.wins[a].dhxContGlobal.obj._offsetHeightSaved = null;}
 this.wins[a].skin = this.skin;this._restoreWindowIcons(this.wins[a]);this._engineRedrawWindowSize(this.wins[a]);}
 }
 
 
 this._engineSwitchWindowProgress = function(win, state) {if (state == true){win.childNodes[0].childNodes[(this._isIE6?1:0)].style.display = "none";win.childNodes[0].childNodes[(this._isIE6?2:1)].style.display = "";}else {win.childNodes[0].childNodes[(this._isIE6?2:1)].style.display = "none";win.childNodes[0].childNodes[(this._isIE6?1:0)].style.display = "";}
 }
 
 
 this._engineSwitchWindowHeader = function(win, state) {if (!win._noHeader)win._noHeader = false;if (state != win._noHeader)return;win._noHeader = (state==true?false:true);win._hdrSize = 0;win.childNodes[0].childNodes[(this._isIE6?5:4)].className = "dhtmlx_wins_body_inner"+(win._noHeader?" dhtmlx_wins_no_header":"");win.childNodes[0].childNodes[(this._isIE6?6:5)].style.display = (win._noHeader?"":"none");win.childNodes[0].childNodes[(this._isIE6?1:0)].style.display = (win._noHeader?"none":"");win.childNodes[0].childNodes[(this._isIE6?3:2)].style.display = (win._noHeader?"none":"");win.childNodes[0].childNodes[(this._isIE6?4:3)].style.display = (win._noHeader?"none":"");var sk = this._engineSkinParams[this.skin];if (win._noHeader){win.dhxContGlobal.obj._offsetHeightSaved = win.dhxContGlobal.obj._offsetHeight;win.dhxContGlobal.obj._offsetHeight = sk["noh_h"];win.dhxContGlobal.obj._offsetTop = sk["noh_t"];}else {win.dhxContGlobal.obj._offsetHeight = win.dhxContGlobal.obj._offsetHeightSaved;win.dhxContGlobal.obj._offsetTop = null;}
 this._engineRedrawWindowSize(win);}
 
 
 this._engineGetWindowHeaderState = function(win) {return (win._noHeader?true:false);}
 
 
 this._engineGetWindowLabel = function(win) {return win.childNodes[0].childNodes[(this._isIE6?3:2)];}
 
 
 this._engineRedrawWindowTitle = function(win) {if (win._noHeader!==true){var p2 = win.childNodes[0].childNodes[(this._isIE6?1:0)].offsetWidth;var p3 = win.childNodes[0].childNodes[(this._isIE6?4:3)].offsetWidth;var newW = win.offsetWidth-p2-p3-24;if (newW < 0)newW = "100%";else newW += "px";win.childNodes[0].childNodes[(this._isIE6?3:2)].style.width = newW;}
 }
 
};dhtmlXWindows.prototype.i18n = {dhxcontaler: "dhtmlxcontainer.js is missed on the page",
 noenginealert: "No dhtmlxWindows engine was found.",
 stick: "Stick",
 unstick: "Unstick",
 help: "Help",
 parkdown: "Park Down",
 parkup: "Park Up",
 maximize: "Maximize",
 restore: "Restore",
 close: "Close",
 dock: "Dock"
};(function(){dhtmlx.extend_api("dhtmlXWindows",{_init:function(obj){return [];},
 _patch:function(obj){obj.old_createWindow=obj.createWindow;obj.createWindow=function(obj){if (arguments.length>1)return this.old_createWindow.apply(this,arguments);var res = this.old_createWindow(obj.id,(obj.x||obj.left),(obj.y||obj.top),obj.width,obj.height);res.allowMoveA=function(mode){if (mode)this.allowMove();else this.denyMove();}
 res.allowParkA=function(mode){if (mode)this.allowPark();else this.denyPark();}
 res.allowResizeA=function(mode){if (mode)this.allowResize();else this.denyResize();}
 
 
 for (var a in obj){if (map[a])res[map[a]](obj[a]);else if (a.indexOf("on")==0){res.attachEvent(a,obj[a]);}
 }
 return res;}
 },
 animation:"setEffect",
 image_path:"setImagePath",
 skin:"setSkin",
 viewport:"_viewport",
 wins:"_wins"
 },{_viewport:function(data){if (data.object){this.enableAutoViewport(false);this.attachViewportTo(data.object);}else {this.enableAutoViewport(false);this.setViewport(data.left, data.top, data.width, data.height, data.parent);}
 },
 _wins:function(arr){for (var q=0;q<arr.length;q++){var win = arr[q];this.createWindow(win.id, win.left, win.top, win.width, win.height);if (win.text)this.window(win.id).setText(win.text);if (win.keep_in_viewport)this.window(win.id).keepInViewport(true);if (win.deny_resize)this.window(win.id).denyResize();if (win.deny_park)this.window(win.id).denyPark();if (win.deny_move)this.window(win.id).denyMove();}
 }
 });var map={move:"allowMoveA",
 park:"allowParkA",
 resize:"allowResizeA",
 center:"center",
 modal:"setModal",
 caption:"setText",
 header:"showHeader"
 };})();window.dhx||(dhx={});dhx.version="3.0";dhx.codebase="./";dhx.name="Core";dhx.clone=function(a){var b=dhx.clone.xa;b.prototype=a;return new b};dhx.clone.xa=function(){};dhx.extend=function(a,b,c){if(a.q)return dhx.PowerArray.insertAt.call(a.q,b,1),a;for(var d in b)if(!a[d]||c)a[d]=b[d];b.defaults&&dhx.extend(a.defaults,b.defaults);b.$init&&b.$init.call(a);return a};dhx.copy=function(a){if(arguments.length>1)var b=arguments[0],a=arguments[1];else b=dhx.isArray(a)?[]:{};for(var c in a)a[c]&&typeof a[c]=="object"&&!dhx.isDate(a[c])?(b[c]=dhx.isArray(a[c])?[]:{},dhx.copy(b[c],a[c])):b[c]=a[c];return b};dhx.single=function(a){var b=null,c=function(c){b||(b=new a({}));b.Ia&&b.Ia.apply(b,arguments);return b};return c};dhx.protoUI=function(){var a=arguments,b=a[0].name,c=function(a){if(!c)return dhx.ui[b].prototype;var e=c.q;if(e){for(var f=[e[0]],g=1;g<e.length;g++)f[g]=e[g],f[g].q&&(f[g]=f[g].call(dhx,f[g].name)),f[g].prototype&&f[g].prototype.name&&(dhx.ui[f[g].prototype.name]=f[g]);dhx.ui[b]=dhx.proto.apply(dhx,f);if(c.r)for(g=0;g<c.r.length;g++)dhx.Type(dhx.ui[b],c.r[g]);c=e=null}return this!=dhx?new dhx.ui[b](a):dhx.ui[b]};c.q=Array.prototype.slice.call(arguments,0);return dhx.ui[b]=c};dhx.proto=function(){for(var a=arguments,b=a[0],c=!!b.$init,d=[],e=a.length-1;e>0;e--){if(typeof a[e]=="function")a[e]=a[e].prototype;a[e].$init&&d.push(a[e].$init);if(a[e].defaults){var f=a[e].defaults;if(!b.defaults)b.defaults={};for(var g in f)dhx.isUndefined(b.defaults[g])&&(b.defaults[g]=f[g])}if(a[e].type&&b.type)for(g in a[e].type)b.type[g]||(b.type[g]=a[e].type[g]);for(var h in a[e])b[h]||(b[h]=a[e][h])}c&&d.push(b.$init);b.$init=function(){for(var a=0;a<d.length;a++)d[a].apply(this,arguments)};var i=function(a){this.$ready=[];this.$init(a);this.$&&this.$(a,this.defaults);for(var b=0;b<this.$ready.length;b++)this.$ready[b].call(this)};i.prototype=b;b=a=null;return i};dhx.bind=function(a,b){return function(){return a.apply(b,arguments)}};dhx.require=function(a,b,c,d,e){if(typeof a!="string"){var f=a.length||0,g=b;if(f)b=function(){if(f)f--,dhx.require(a[a.length-f-1],b,c);else return g.apply(this,arguments)},b();else{for(var h in a)f++;b=function(){f--;f==0&&g.apply(this,arguments)};for(h in a)dhx.require(h,b,c)}}else if(dhx.i[a]!==!0)if(a.substr(-4)==".css"){var i=dhx.html.create("LINK",{type:"text/css",rel:"stylesheet",href:dhx.codebase+a});document.head.appendChild(i);b&&b.call(c||window)}else{var j=e;b?dhx.i[a]?dhx.i[a].push([b,
c]):(dhx.i[a]=[[b,c]],dhx.ajax(dhx.codebase+a,function(b){dhx.exec(b);var c=dhx.i[a];dhx.i[a]=!0;for(var d=0;d<c.length;d++)c[d][0].call(c[d][1]||window,!d)})):(dhx.exec(dhx.ajax().sync().get(dhx.codebase+a).responseText),dhx.i[a]=!0)}};dhx.i={};dhx.exec=function(a){window.execScript?window.execScript(a):window.eval(a)};dhx.wrap=function(a,b){return!a?b:function(){var c=a.apply(this,arguments);b.apply(this,arguments);return c}};dhx.isUndefined=function(a){return typeof a=="undefined"};dhx.delay=function(a,b,c,d){return window.setTimeout(function(){var d=a.apply(b,c||[]);a=b=c=null;return d},d||1)};dhx.uid=function(){if(!this.R)this.R=(new Date).valueOf();this.R++;return this.R};dhx.toNode=function(a){return typeof a=="string"?document.getElementById(a):a};dhx.toArray=function(a){return dhx.extend(a||[],dhx.PowerArray,!0)};dhx.toFunctor=function(a){return typeof a=="string"?eval(a):a};dhx.isArray=function(a){return Array.isArray?Array.isArray(a):Object.prototype.toString.call(a)==="[object Array]"};dhx.isDate=function(a){return a instanceof Date};dhx.L={};dhx.event=function(a,b,c,d){var a=dhx.toNode(a),e=dhx.uid();d&&(c=dhx.bind(c,d));dhx.L[e]=[a,b,c];a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c);return e};dhx.eventRemove=function(a){if(a){var b=dhx.L[a];b[0].removeEventListener?b[0].removeEventListener(b[1],b[2],!1):b[0].detachEvent&&b[0].detachEvent("on"+b[1],b[2]);delete this.L[a]}};dhx.EventSystem={$init:function(){if(!this.e)this.e={},this.s={},this.M={}},blockEvent:function(){this.e.T=!0},unblockEvent:function(){this.e.T=!1},mapEvent:function(a){dhx.extend(this.M,a,!0)},on_setter:function(a){if(a)for(var b in a)typeof a[b]=="function"&&this.attachEvent(b,a[b])},callEvent:function(a,b){if(this.e.T)return!0;var a=a.toLowerCase(),c=this.e[a.toLowerCase()],d=!0;if(c)for(var e=0;e<c.length;e++)if(c[e].apply(this,b||[])===!1)d=!1;this.M[a]&&!this.M[a].callEvent(a,b)&&(d=!1);return d},
attachEvent:function(a,b,c){var a=a.toLowerCase(),c=c||dhx.uid(),b=dhx.toFunctor(b),d=this.e[a]||dhx.toArray();d.push(b);this.e[a]=d;this.s[c]={f:b,t:a};return c},detachEvent:function(a){if(this.s[a]){var b=this.s[a].t,c=this.s[a].f,d=this.e[b];d.remove(c);delete this.s[a]}},hasEvent:function(a){a=a.toLowerCase();return this.e[a]?!0:!1}};dhx.extend(dhx,dhx.EventSystem);dhx.PowerArray={removeAt:function(a,b){a>=0&&this.splice(a,b||1)},remove:function(a){this.removeAt(this.find(a))},insertAt:function(a,b){if(!b&&b!==0)this.push(a);else{var c=this.splice(b,this.length-b);this[b]=a;this.push.apply(this,c)}},find:function(a){for(var b=0;b<this.length;b++)if(a==this[b])return b;return-1},each:function(a,b){for(var c=0;c<this.length;c++)a.call(b||this,this[c])},map:function(a,b){for(var c=0;c<this.length;c++)this[c]=a.call(b||this,this[c]);return this},filter:function(a,
b){for(var c=0;c<this.length;c++)a.call(b||this,this[c])||(this.splice(c,1),c--);return this}};dhx.env={};(function(){if(navigator.userAgent.indexOf("Mobile")!=-1)dhx.env.mobile=!0;if(dhx.env.mobile||navigator.userAgent.indexOf("iPad")!=-1||navigator.userAgent.indexOf("Android")!=-1)dhx.env.touch=!0;navigator.userAgent.indexOf("Opera")!=-1?dhx.env.isOpera=!0:(dhx.env.isIE=!!document.all,dhx.env.isFF=!document.all,dhx.env.isWebKit=navigator.userAgent.indexOf("KHTML")!=-1,dhx.env.isSafari=dhx.env.isWebKit&&navigator.userAgent.indexOf("Mac")!=-1);if(navigator.userAgent.toLowerCase().indexOf("android")!=
-1)dhx.env.isAndroid=!0;dhx.env.transform=!1;dhx.env.transition=!1;for(var a={names:["transform","transition"],transform:["transform","WebkitTransform","MozTransform","OTransform","msTransform"],transition:["transition","WebkitTransition","MozTransition","OTransition","msTransition"]},b=document.createElement("DIV"),c=0;c<a.names.length;c++)for(var d=a[a.names[c]],e=0;e<d.length;e++)if(typeof b.style[d[e]]!="undefined"){dhx.env[a.names[c]]=d[e];break}b.style[dhx.env.transform]="translate3d(0,0,0)";dhx.env.translate=b.style[dhx.env.transform]?"translate3d":"translate";var f="",g=!1;dhx.env.isOpera&&(f="-o-",g="O");dhx.env.isFF&&(f="-Moz-");dhx.env.isWebKit&&(f="-webkit-");dhx.env.isIE&&(f="-ms-");dhx.env.transformCSSPrefix=f;dhx.env.transformPrefix=g||dhx.env.transformCSSPrefix.replace(/-/gi,"");dhx.env.transitionEnd=dhx.env.transformCSSPrefix=="-Moz-"?"transitionend":dhx.env.transformPrefix+"TransitionEnd"})();dhx.env.svg=function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}();dhx.html={v:0,denySelect:function(){if(!dhx.v)dhx.v=document.onselectstart;document.onselectstart=dhx.html.stopEvent},allowSelect:function(){if(dhx.v!==0)document.onselectstart=dhx.v||null;dhx.v=0},index:function(a){for(var b=0;a=a.previousSibling;)b++;return b},ga:{},createCss:function(a){var b="",c;for(c in a)b+=c+":"+a[c]+";";var d=this.ga[b];d||(d="s"+dhx.uid(),this.addStyle("."+d+"{"+b+"}"),this.ga[b]=d);return d},addStyle:function(a){var b=document.createElement("style");b.setAttribute("type",
"text/css");b.setAttribute("media","screen");b.styleSheet?b.styleSheet.cssText=a:b.appendChild(document.createTextNode(a));document.getElementsByTagName("head")[0].appendChild(b)},create:function(a,b,c){var b=b||{},d=document.createElement(a),e;for(e in b)d.setAttribute(e,b[e]);if(b.style)d.style.cssText=b.style;if(b["class"])d.className=b["class"];if(c)d.innerHTML=c;return d},getValue:function(a){a=dhx.toNode(a);return!a?"":dhx.isUndefined(a.value)?a.innerHTML:a.value},remove:function(a){if(a instanceof
Array)for(var b=0;b<a.length;b++)this.remove(a[b]);else a&&a.parentNode&&a.parentNode.removeChild(a)},insertBefore:function(a,b,c){a&&(b&&b.parentNode?b.parentNode.insertBefore(a,b):c.appendChild(a))},locate:function(a,b){if(a.tagName)var c=a;else a=a||event,c=a.target||a.srcElement;for(;c;){if(c.getAttribute){var d=c.getAttribute(b);if(d)return d}c=c.parentNode}return null},offset:function(a){if(a.getBoundingClientRect){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=
window.pageYOffset||d.scrollTop||c.scrollTop,f=window.pageXOffset||d.scrollLeft||c.scrollLeft,g=d.clientTop||c.clientTop||0,h=d.clientLeft||c.clientLeft||0,i=b.top+e-g,j=b.left+f-h;return{y:Math.round(i),x:Math.round(j)}}else{for(j=i=0;a;)i+=parseInt(a.offsetTop,10),j+=parseInt(a.offsetLeft,10),a=a.offsetParent;return{y:i,x:j}}},posRelative:function(a){a=a||event;return dhx.isUndefined(a.offsetX)?{x:a.layerX,y:a.layerY}:{x:a.offsetX,y:a.offsetY}},pos:function(a){a=a||event;if(a.pageX||a.pageY)return{x:a.pageX,
y:a.pageY};var b=dhx.env.isIE&&document.compatMode!="BackCompat"?document.documentElement:document.body;return{x:a.clientX+b.scrollLeft-b.clientLeft,y:a.clientY+b.scrollTop-b.clientTop}},preventEvent:function(a){a&&a.preventDefault&&a.preventDefault();return dhx.html.stopEvent(a)},stopEvent:function(a){(a||event).cancelBubble=!0;return!1},addCss:function(a,b){a.className+=" "+b},removeCss:function(a,b){a.className=a.className.replace(RegExp(" "+b,"g"),"")}};dhx.ready=function(a){this.Ga?a.call():this.D.push(a)};dhx.D=[];(function(){var a=document.getElementsByTagName("SCRIPT");if(a.length)a=(a[a.length-1].getAttribute("src")||"").split("/"),a.splice(a.length-1,1),dhx.codebase=a.slice(0,a.length).join("/")+"/";dhx.event(window,"load",function(){dhx.callEvent("onReady",[]);dhx.delay(function(){dhx.Ga=!0;for(var a=0;a<dhx.D.length;a++)dhx.D[a].call();dhx.D=[]})})})();dhx.locale=dhx.locale||{};dhx.ready(function(){dhx.event(document.body,"click",function(a){dhx.callEvent("onClick",[a||event])})});(function(){var a={},b=RegExp("(\\r\\n|\\n)","g"),c=RegExp('(\\")',"g");dhx.Template=function(d){if(typeof d=="function")return d;if(a[d])return a[d];d=(d||"").toString();if(d.indexOf("->")!=-1)switch(d=d.split("->"),d[0]){case "html":d=dhx.html.getValue(d[1]);break;case "http":d=(new dhx.ajax).sync().get(d[1],{uid:dhx.uid()}).responseText}d=(d||"").toString();d=d.replace(b,"\\n");d=d.replace(c,'\\"');d=d.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');d=d.replace(/\{common\.([^}\(]*)\}/g,
"\"+(common.$1||'')+\"");d=d.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1.apply(this, arguments):"")+"');d=d.replace(/\{obj\.([^}]*)\}/g,'"+(obj.$1)+"');d=d.replace("{obj}",'"+obj+"');d=d.replace(/#([^#'";, ]+)#/gi,'"+(obj.$1)+"');try{a[d]=Function("obj","common",'return "'+d+'";')}catch(e){}return a[d]};dhx.Template.empty=function(){return""};dhx.Template.bind=function(a){return dhx.bind(dhx.Template(a),this)};dhx.Type=function(a,b){if(a.q){if(!a.r)a.r=[];a.r.push(b)}else{if(typeof a==
"function")a=a.prototype;if(!a.types)a.types={"default":a.type},a.type.name="default";var c=b.name,g=a.type;c&&(g=a.types[c]=dhx.clone(b.baseType?a.types[b.baseType]:a.type));for(var h in b)g[h]=h.indexOf("template")===0?dhx.Template(b[h]):b[h];return c}}})();dhx.Settings={$init:function(){this.a=this.config={}},define:function(a,b){return typeof a=="object"?this.Q(a):this.U(a,b)},U:function(a,b){var c=this[a+"_setter"];return this.a[a]=c?c.call(this,b,a):b},Q:function(a){if(a)for(var b in a)this.U(b,a[b])},$:function(a,b){var c={};b&&(c=dhx.extend(c,b));typeof a=="object"&&!a.tagName&&dhx.extend(c,a,!0);this.Q(c)},Ba:function(a,b){for(var c in b)switch(typeof a[c]){case "object":a[c]=this.Ba(a[c]||{},b[c]);break;case "undefined":a[c]=b[c]}return a}};dhx.ajax=function(a,b,c){if(arguments.length!==0){var d=new dhx.ajax;if(c)d.master=c;return d.get(a,null,b)}return!this.getXHR?new dhx.ajax:this};dhx.ajax.count=0;dhx.ajax.prototype={master:null,getXHR:function(){return dhx.env.isIE?new ActiveXObject("Microsoft.xmlHTTP"):new XMLHttpRequest},send:function(a,b,c){var d=this.getXHR();dhx.isArray(c)||(c=[c]);if(typeof b=="object"){var e=[],f;for(f in b){var g=b[f];if(g===null||g===dhx.undefined)g="";e.push(f+"="+encodeURIComponent(g))}b=e.join("&")}b&&this.request==="GET"&&(a=a+(a.indexOf("?")!=-1?"&":"?")+b,b=null);d.open(this.request,a,!this.Na);this.request==="POST"&&d.setRequestHeader("Content-type","application/x-www-form-urlencoded");var h=this;d.onreadystatechange=function(){if(!d.readyState||d.readyState==4){dhx.ajax.count++;if(c&&h)for(var a=0;a<c.length;a++)if(c[a]){var b=c[a].success||c[a];if(d.status>=400||!d.status&&!d.responseText)b=c[a].error;b&&b.call(h.master||h,d.responseText,d.responseXML,d)}if(h)h.master=null;c=h=null}};d.send(b||null);return d},get:function(a,b,c){this.request="GET";return this.send(a,b,c)},post:function(a,b,c){this.request="POST";return this.send(a,b,c)},put:function(a,b,c){this.request="PUT";return this.send(a,b,c)},del:function(a,b,c){this.request="DELETE";return this.send(a,b,c)},sync:function(){this.Na=!0;return this},bind:function(a){this.master=a;return this}};dhx.send=function(a,b,c,d){var e=dhx.html.create("FORM",{target:d||"_self",action:a,method:c||"POST"},""),f;for(f in b){var g=dhx.html.create("INPUT",{type:"hidden",name:f,value:b[f]},"");e.appendChild(g)}e.style.display="none";document.body.appendChild(e);e.submit();document.body.removeChild(e)};dhx.AtomDataLoader={$init:function(a){this.data={};if(a)this.a.datatype=a.datatype||"json",this.$ready.push(this.Aa)},Aa:function(){this.aa=!0;this.a.url&&this.url_setter(this.a.url);this.a.data&&this.data_setter(this.a.data)},url_setter:function(a){if(!this.aa)return a;this.load(a,this.a.datatype);return a},data_setter:function(a){if(!this.aa)return a;this.parse(a,this.a.datatype);return!0},load:function(a,b,c){if(a.$proxy)a.load(this,typeof b=="string"?b:"json");else{this.callEvent("onXLS",[]);if(typeof b=="string")this.data.driver=dhx.DataDriver[b],b=c;else if(!this.data.driver)this.data.driver=dhx.DataDriver.json;var d=[{success:this.P,error:this.C}];b&&(dhx.isArray(b)?d.push.apply(d,b):d.push(b));return dhx.ajax(a,d,this)}},parse:function(a,b){this.callEvent("onXLS",[]);this.data.driver=dhx.DataDriver[b||"json"];this.P(a,null)},P:function(a,b,c){var d=this.data.driver,e=d.toObject(a,b);if(e){var f=d.getRecords(e)[0];this.data=d?d.getDetails(f):a}else this.C(a,b,c);this.callEvent("onXLE",
[])},C:function(a,b,c){this.callEvent("onXLE",[]);this.callEvent("onLoadError",arguments);dhx.callEvent("onLoadError",[a,b,c,this])},z:function(a){if(!this.a.dataFeed||this.N||!a)return!0;var b=this.a.dataFeed;if(typeof b=="function")return b.call(this,a.id||a,a);b=b+(b.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(a.id||a);this.callEvent("onXLS",[]);dhx.ajax(b,function(a,b,e){this.N=!0;var f=dhx.DataDriver.toObject(a,b);f?this.setValues(f.getDetails(f.getRecords()[0])):this.C(a,b,
e);this.N=!1;this.callEvent("onXLE",[])},this);return!1}};dhx.DataDriver={};dhx.DataDriver.json={toObject:function(a){a||(a="[]");if(typeof a=="string"){try{eval("dhx.temp="+a)}catch(b){return null}a=dhx.temp}if(a.data){var c=a.data.config={},d;for(d in a)d!="data"&&(c[d]=a[d]);a=a.data}return a},getRecords:function(a){return a&&!dhx.isArray(a)?[a]:a},getDetails:function(a){return typeof a=="string"?{id:dhx.uid(),value:a}:a},getInfo:function(a){var b=a.config;return!b?{}:{n:b.total_count||0,m:b.pos||0,Ea:b.parent||0,K:b.config,O:b.dhx_security}},child:"data"};dhx.DataDriver.html={toObject:function(a){if(typeof a=="string"){var b=null;a.indexOf("<")==-1&&(b=dhx.toNode(a));if(!b)b=document.createElement("DIV"),b.innerHTML=a;return b.getElementsByTagName(this.tag)}return a},getRecords:function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];d.nodeType==1&&b.push(d)}return b},getDetails:function(a){return dhx.DataDriver.xml.tagToObject(a)},getInfo:function(){return{n:0,m:0}},tag:"LI"};dhx.DataDriver.jsarray={toObject:function(a){return typeof a=="string"?(eval("dhx.temp="+a),dhx.temp):a},getRecords:function(a){return a},getDetails:function(a){for(var b={},c=0;c<a.length;c++)b["data"+c]=a[c];return b},getInfo:function(){return{n:0,m:0}}};dhx.DataDriver.csv={toObject:function(a){return a},getRecords:function(a){return a.split(this.row)},getDetails:function(a){for(var a=this.stringToArray(a),b={},c=0;c<a.length;c++)b["data"+c]=a[c];return b},getInfo:function(){return{n:0,m:0}},stringToArray:function(a){for(var a=a.split(this.cell),b=0;b<a.length;b++)a[b]=a[b].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"");return a},row:"\n",cell:","};dhx.DataDriver.xml={Y:function(a){return!a||!a.documentElement?null:a.getElementsByTagName("parsererror").length?null:a},toObject:function(a){if(this.Y(b))return b;var b=typeof a=="string"?this.fromString(a.replace(/^[\s]+/,"")):a;return this.Y(b)?b:null},getRecords:function(a){return this.xpath(a,this.records)},records:"/*/item",child:"item",config:"/*/config",getDetails:function(a){return this.tagToObject(a,{})},getInfo:function(a){var b=this.xpath(a,this.config),b=b.length?this.assignTypes(this.tagToObject(b[0],
{})):null;return{n:a.documentElement.getAttribute("total_count")||0,m:a.documentElement.getAttribute("pos")||0,Ea:a.documentElement.getAttribute("parent")||0,K:b,O:a.documentElement.getAttribute("dhx_security")||null}},xpath:function(a,b){if(window.XPathResult){var c=a;if(a.nodeName.indexOf("document")==-1)a=a.ownerDocument;for(var d=[],e=a.evaluate(b,c,null,XPathResult.ANY_TYPE,null),f=e.iterateNext();f;)d.push(f),f=e.iterateNext();return d}else{var g=!0;try{typeof a.selectNodes=="undefined"&&(g=
!1)}catch(h){}if(g)return a.selectNodes(b);else{var i=b.split("/").pop();return a.getElementsByTagName(i)}}},assignTypes:function(a){for(var b in a){var c=a[b];typeof c=="object"?this.assignTypes(c):typeof c=="string"&&c!==""&&(c=="true"?a[b]=!0:c=="false"?a[b]=!1:c==c*1&&(a[b]*=1))}return a},tagToObject:function(a,b){var b=b||{},c=!1,d=a.attributes;if(d&&d.length){for(var e=0;e<d.length;e++)b[d[e].name]=d[e].value;c=!0}for(var f=a.childNodes,g={},e=0;e<f.length;e++)if(f[e].nodeType==1){var h=f[e].tagName;typeof b[h]!="undefined"?(dhx.isArray(b[h])||(b[h]=[b[h]]),b[h].push(this.tagToObject(f[e],{}))):b[f[e].tagName]=this.tagToObject(f[e],{});c=!0}if(!c)return this.nodeValue(a);b.value=b.value||this.nodeValue(a);return b},nodeValue:function(a){return a.firstChild?a.firstChild.data:""},fromString:function(a){try{if(window.DOMParser)return(new DOMParser).parseFromString(a,"text/xml");if(window.ActiveXObject){var b=new ActiveXObject("Microsoft.xmlDOM");b.loadXML(a);return b}}catch(c){return null}}};dhx.DataLoader=dhx.proto({$init:function(a){a=a||"";this.o=dhx.toArray();this.data=new dhx.DataStore;this.data.attachEvent("onClearAll",dhx.bind(this.oa,this));this.data.attachEvent("onServerConfig",dhx.bind(this.na,this));this.data.feed=this.sa},sa:function(a,b,c){if(this.u)return this.u=[a,b,c];else this.u=!0;this.W=[a,b];this.ua.call(this,a,b,c)},ua:function(a,b,c){var d=this.data.url;a<0&&(a=0);this.load(d+(d.indexOf("?")==-1?"?":"&")+(this.dataCount()?"continue=true&":"")+"start="+a+"&count="+
b,[this.ta,c])},ta:function(){var a=this.u,b=this.W;this.u=!1;typeof a=="object"&&(a[0]!=b[0]||a[1]!=b[1])&&this.data.feed.apply(this,a)},load:function(a,b){var c=dhx.AtomDataLoader.load.apply(this,arguments);this.o.push(c);if(!this.data.url)this.data.url=a},loadNext:function(a,b,c,d,e){this.a.datathrottle&&!e?(this.ha&&window.clearTimeout(this.ha),this.ha=dhx.delay(function(){this.loadNext(a,b,c,d,!0)},this,0,this.a.datathrottle)):(!b&&b!==0&&(b=this.dataCount()),this.data.url=this.data.url||d,this.callEvent("onDataRequest",
[b,a,c,d])&&this.data.url&&this.data.feed.call(this,b,a,c))},Ra:function(a,b){var c=this.W;return this.u&&c&&c[0]<=b&&c[1]+c[0]>=a+b?!0:!1},P:function(a,b,c){this.o.remove(c);var d=this.data.driver.toObject(a,b);if(d)this.data.Fa(d);else return this.C(a,b,c);this.pa();this.callEvent("onXLE",[])},removeMissed_setter:function(a){return this.data.Ja=a},scheme_setter:function(a){this.data.scheme(a)},dataFeed_setter:function(a){this.data.attachEvent("onBeforeFilter",dhx.bind(function(a,c){if(this.a.dataFeed){var d=
{};if(a||c){if(typeof a=="function"){if(!c)return;a(c,d)}else d={text:c};this.clearAll();var e=this.a.dataFeed,f=[];if(typeof e=="function")return e.call(this,c,d);for(var g in d)f.push("dhx_filter["+g+"]="+encodeURIComponent(d[g]));this.load(e+(e.indexOf("?")<0?"?":"&")+f.join("&"),this.a.datatype);return!1}}},this));return a},pa:function(){if(this.a.ready&&!this.Ha){var a=dhx.toFunctor(this.a.ready);a&&dhx.delay(a,this,arguments);this.Ha=!0}},oa:function(){for(var a=0;a<this.o.length;a++)this.o[a].abort();this.o=dhx.toArray()},na:function(a){this.Q(a)}},dhx.AtomDataLoader);dhx.DataStore=function(){this.name="DataStore";dhx.extend(this,dhx.EventSystem);this.setDriver("json");this.pull={};this.order=dhx.toArray();this.d={}};dhx.DataStore.prototype={setDriver:function(a){this.driver=dhx.DataDriver[a]},Fa:function(a){this.callEvent("onParse",[this.driver,a]);this.c&&this.filter();var b=this.driver.getInfo(a);if(b.O)dhx.securityKey=b.O;b.K&&this.callEvent("onServerConfig",[b.K]);var c=this.driver.getRecords(a);this.za(b,c);this.ba&&this.ya&&this.ya(this.ba);this.da&&(this.blockEvent(),this.sort(this.da),this.unblockEvent());this.callEvent("onStoreLoad",[this.driver,a]);this.refresh()},za:function(a,b){var c=(a.m||0)*1,
d=!0,e=!1;if(c===0&&this.order[0]){if(this.Ja)for(var e={},f=0;f<this.order.length;f++)e[this.order[f]]=!0;d=!1;c=this.order.length}for(var g=0,f=0;f<b.length;f++){var h=this.driver.getDetails(b[f]),i=this.id(h);this.pull[i]?d&&this.order[g+c]&&g++:(this.order[g+c]=i,g++);this.pull[i]?(dhx.extend(this.pull[i],h,!0),this.H&&this.H(this.pull[i]),e&&delete e[i]):(this.pull[i]=h,this.G&&this.G(h))}if(e){this.blockEvent();for(var j in e)this.remove(j);this.unblockEvent()}if(!this.order[a.n-1])this.order[a.n-
1]=dhx.undefined},id:function(a){return a.id||(a.id=dhx.uid())},changeId:function(a,b){this.pull[a]&&(this.pull[b]=this.pull[a]);this.pull[b].id=b;this.order[this.order.find(a)]=b;this.c&&(this.c[this.c.find(a)]=b);this.d[a]&&(this.d[b]=this.d[a],delete this.d[a]);this.callEvent("onIdChange",[a,b]);this.Ka&&this.Ka(a,b);delete this.pull[a]},item:function(a){return this.pull[a]},update:function(a,b){dhx.isUndefined(b)&&(b=this.item(a));this.H&&this.H(b);if(this.callEvent("onBeforeUpdate",[a,b])===
!1)return!1;this.pull[a]=b;this.callEvent("onStoreUpdated",[a,b,"update"])},refresh:function(a){this.fa||(a?this.callEvent("onStoreUpdated",[a,this.pull[a],"paint"]):this.callEvent("onStoreUpdated",[null,null,null]))},silent:function(a,b){this.fa=!0;a.call(b||this);this.fa=!1},getRange:function(a,b){a=a?this.indexById(a):this.$min||this.startOffset||0;b?b=this.indexById(b):(b=Math.min(this.$max||this.endOffset||Infinity,this.dataCount()-1),b<0&&(b=0));if(a>b)var c=b,b=a,a=c;return this.getIndexRange(a,
b)},getIndexRange:function(a,b){for(var b=Math.min(b||Infinity,this.dataCount()-1),c=dhx.toArray(),d=a||0;d<=b;d++)c.push(this.item(this.order[d]));return c},dataCount:function(){return this.order.length},exists:function(a){return!!this.pull[a]},move:function(a,b){var c=this.idByIndex(a),d=this.item(c);this.order.removeAt(a);this.order.insertAt(c,Math.min(this.order.length,b));this.callEvent("onStoreUpdated",[c,d,"move"])},scheme:function(a){this.F={};this.G=a.$init;this.H=a.$update;this.ca=a.$serialize;this.ba=a.$group;this.da=a.$sort;for(var b in a)b.substr(0,1)!="$"&&(this.F[b]=a[b])},sync:function(a,b,c){typeof a=="string"&&(a=$$("source"));typeof b!="function"&&(c=b,b=null);this.I=!1;if(a.name!="DataStore")a.data&&a.data.name=="DataStore"?a=a.data:this.I=!0;var d=dhx.bind(function(d,f,g){if(this.I){if(!d)return;if(d.indexOf("change")==0){if(d=="change")this.pull[f.id]=f.attributes,this.refresh(f.id);return}d=="reset"&&(g=f);this.order=[];this.pull={};this.c=null;for(var h=0;h<g.models.length;h++){var i=
g.models[h].id;this.order.push(i);this.pull[i]=g.models[h].attributes}}else this.c=null,this.order=dhx.toArray([].concat(a.order)),this.pull=a.pull;b&&this.silent(b);this.Z&&this.Z();this.callEvent("onSyncApply",[]);c?c=!1:this.refresh()},this);this.I?a.bind("all",d):this.w=[a.attachEvent("onStoreUpdated",d)];d()},add:function(a,b,c){if(this.F)for(var d in this.F)dhx.isUndefined(a[d])&&(a[d]=this.F[d]);this.G&&this.G(a);var e=this.id(a),f=c||this.order,g=f.length;if(dhx.isUndefined(b)||b<0)b=g;b>
g&&(b=Math.min(f.length,b));if(this.callEvent("onBeforeAdd",[e,a,b])===!1)return!1;this.pull[e]=a;f.insertAt(e,b);if(this.c){var h=this.c.length;!b&&this.order.length&&(h=0);this.c.insertAt(e,h)}this.callEvent("onAfterAdd",[e,b]);this.callEvent("onStoreUpdated",[e,a,"add"]);return e},remove:function(a){if(dhx.isArray(a))for(var b=0;b<a.length;b++)this.remove(a[b]);else{if(this.callEvent("onBeforeDelete",[a])===!1)return!1;var c=this.item(a);this.order.remove(a);this.c&&this.c.remove(a);delete this.pull[a];this.d[a]&&delete this.d[a];this.callEvent("onAfterDelete",[a]);this.callEvent("onStoreUpdated",[a,c,"delete"])}},clearAll:function(){this.pull={};this.order=dhx.toArray();this.c=null;this.callEvent("onClearAll",[]);this.refresh()},idByIndex:function(a){return this.order[a]},indexById:function(a){var b=this.order.find(a);return b},next:function(a,b){return this.order[this.indexById(a)+(b||1)]},first:function(){return this.order[0]},last:function(){return this.order[this.order.length-1]},previous:function(a,
b){return this.order[this.indexById(a)-(b||1)]},sort:function(a,b,c){var d=a;typeof a=="function"?d={as:a,dir:b}:typeof a=="string"&&(d={by:a.replace(/#/g,""),dir:b,as:c});var e=[d.by,d.dir,d.as];this.callEvent("onBeforeSort",e)&&(this.Ma(d),this.refresh(),this.callEvent("onAfterSort",e))},Ma:function(a){if(this.order.length){var b=this.La.qa(a),c=this.getRange(this.first(),this.last());c.sort(b);this.order=c.map(function(a){return this.id(a)},this)}},wa:function(a){if(this.c&&!a)this.order=this.c,
delete this.c},va:function(a,b,c){for(var d=dhx.toArray(),e=0;e<this.order.length;e++){var f=this.order[e];a(this.item(f),b)&&d.push(f)}if(!c||!this.c)this.c=this.order;this.order=d},filter:function(a,b,c){if(this.callEvent("onBeforeFilter",[a,b])&&(this.wa(c),this.order.length)){if(a){var d=a,b=b||"";typeof a=="string"&&(a=a.replace(/#/g,""),b=b.toString().toLowerCase(),d=function(b,c){return(b[a]||"").toString().toLowerCase().indexOf(c)!=-1});this.va(d,b,c,this.Pa)}this.refresh();this.callEvent("onAfterFilter",
[])}},each:function(a,b){for(var c=0;c<this.order.length;c++)a.call(b||this,this.item(this.order[c]))},Ca:function(a,b){return function(){return a[b].apply(a,arguments)}},addMark:function(a,b,c,d){var e=this.d[a]||{};this.d[a]=e;if(!e[b]&&(e[b]=d||!0,c))this.item(a).$css=(this.item(a).$css||"")+" "+b,this.refresh(a);return e[b]},removeMark:function(a,b,c){var d=this.d[a];d&&d[b]&&delete d[b];if(c){var e=this.item(a).$css;e&&(e=this.item(a).$css.replace(b,""),this.refresh(a))}},hasMark:function(a,
b){var c=this.d[a];return c&&c[b]},provideApi:function(a,b){b&&this.mapEvent({onbeforesort:a,onaftersort:a,onbeforeadd:a,onafteradd:a,onbeforedelete:a,onafterdelete:a,onbeforeupdate:a});for(var c="sort,add,remove,exists,idByIndex,indexById,item,update,refresh,dataCount,filter,next,previous,clearAll,first,last,serialize,sync,addMark,removeMark,hasMark".split(","),d=0;d<c.length;d++)a[c[d]]=this.Ca(this,c[d])},serialize:function(){for(var a=this.order,b=[],c=0;c<a.length;c++){var d=this.pull[a[c]];if(this.ca&&(d=this.ca(d),d===!1))continue;b.push(d)}return b},La:{qa:function(a){return this.ra(a.dir,this.ma(a.by,a.as))},ja:{date:function(a,b){a-=0;b-=0;return a>b?1:a<b?-1:0},"int":function(a,b){a*=1;b*=1;return a>b?1:a<b?-1:0},string_strict:function(a,b){a=a.toString();b=b.toString();return a>b?1:a<b?-1:0},string:function(a,b){if(!b)return 1;if(!a)return-1;a=a.toString().toLowerCase();b=b.toString().toLowerCase();return a>b?1:a<b?-1:0}},ma:function(a,b){if(!a)return b;typeof b!="function"&&
(b=this.ja[b||"string"]);return function(c,d){return b(c[a],d[a])}},ra:function(a,b){return a=="asc"||!a?b:function(a,d){return b(a,d)*-1}}}};dhx.BaseBind={bind:function(a,b,c){typeof a=="string"&&(a=dhx.ui.get(a));a.b&&a.b();this.b&&this.b();a.getBindData||dhx.extend(a,dhx.BindSource);if(!this.ka){var d=this.render;if(this.filter){var e=this.a.id;this.data.Z=function(){a.l[e]=!1}}this.render=function(){if(!this.X){this.X=!0;var a=this.callEvent("onBindRequest");this.X=!1;return d.apply(this,a===!1?arguments:[])}};if(this.getValue||this.getValues)this.save=function(){if(!this.validate||this.validate())a.setBindData(this.getValue?this.getValue:
this.getValues(),this.a.id)};this.ka=!0}a.addBind(this.a.id,b,c);var f=this.a.id;this.attachEvent(this.touchable?"onAfterRender":"onBindRequest",function(){return a.getBindData(f)});!this.a.dataFeed&&this.loadNext&&this.data.attachEvent("onStoreLoad",function(){a.l[f]=!1});this.isVisible(this.a.id)&&this.refresh()},g:function(a){a.removeBind(this.a.id);var b=this.w||(this.data?this.data.w:0);if(b&&a.data)for(var c=0;c<b.length;c++)a.data.detachEvent(b[c])}};dhx.BindSource={$init:function(){this.p={};this.l={};this.A={};this.la(this)},saveBatch:function(a){this.V=!0;a.call(this);this.V=!1;this.k()},setBindData:function(a,b){b&&(this.A[b]=!0);if(this.setValue)this.setValue(a);else if(this.setValues)this.setValues(a);else{var c=this.getCursor();c&&(a=dhx.extend(this.item(c),a,!0),this.update(c,a))}this.callEvent("onBindUpdate",[a,b]);this.save&&this.save();b&&(this.A[b]=!1)},getBindData:function(a,b){if(this.l[a])return!1;var c=dhx.ui.get(a);c.isVisible(c.a.id)&&
(this.l[a]=!0,this.J(c,this.p[a][0],this.p[a][1]),b&&c.filter&&c.refresh())},addBind:function(a,b,c){this.p[a]=[b,c]},removeBind:function(a){delete this.p[a];delete this.l[a];delete this.A[a]},la:function(a){a.filter?dhx.extend(this,dhx.CollectionBind):a.setValue?dhx.extend(this,dhx.ValueBind):dhx.extend(this,dhx.RecordBind)},k:function(){if(!this.V)for(var a in this.p)this.A[a]||(this.l[a]=!1,this.getBindData(a,!0))},S:function(a,b,c){a.setValue?a.setValue(c?c[b]:c):a.filter?a.data.silent(function(){this.filter(b,
c)}):!c&&a.clear?a.clear():a.z(c)&&a.setValues(dhx.clone(c));a.callEvent("onBindApply",[c,b,this])}};dhx.DataValue=dhx.proto({name:"DataValue",isVisible:function(){return!0},$init:function(a){var b=(this.data=a)&&a.id?a.id:dhx.uid();this.a={id:b};dhx.ui.views[b]=this},setValue:function(a){this.data=a;this.callEvent("onChange",[a])},getValue:function(){return this.data},refresh:function(){this.callEvent("onBindRequest")}},dhx.EventSystem,dhx.BaseBind);dhx.DataRecord=dhx.proto({name:"DataRecord",isVisible:function(){return!0},$init:function(a){this.data=a||{};var b=a&&a.id?a.id:dhx.uid();this.a={id:b};dhx.ui.views[b]=this},getValues:function(){return this.data},setValues:function(a){this.data=a;this.callEvent("onChange",[a])},refresh:function(){this.callEvent("onBindRequest")}},dhx.EventSystem,dhx.BaseBind,dhx.AtomDataLoader,dhx.Settings);dhx.DataCollection=dhx.proto({name:"DataCollection",isVisible:function(){return!this.data.order.length&&!this.data.c&&!this.a.dataFeed?!1:!0},$init:function(a){this.data.provideApi(this,!0);var b=a&&a.id?a.id:dhx.uid();this.a.id=b;dhx.ui.views[b]=this;this.data.attachEvent("onStoreLoad",dhx.bind(function(){this.callEvent("onBindRequest",[])},this))},refresh:function(){this.callEvent("onBindRequest",[])}},dhx.DataLoader,dhx.EventSystem,dhx.BaseBind,dhx.Settings);dhx.ValueBind={$init:function(){this.attachEvent("onChange",this.k)},J:function(a,b,c){var d=this.getValue()||"";c&&(d=c(d));if(a.setValue)a.setValue(d);else if(a.filter)a.data.silent(function(){this.filter(b,d)});else{var e={};e[b]=d;a.z(d)&&a.setValues(e)}a.callEvent("onBindApply",[d,b,this])}};dhx.RecordBind={$init:function(){this.attachEvent("onChange",this.k)},J:function(a,b){var c=this.getValues()||null;this.S(a,b,c)}};dhx.CollectionBind={$init:function(){this.h=null;this.attachEvent("onSelectChange",function(){var a=this.getSelected();this.setCursor(a?a.id||a:null)});this.attachEvent("onAfterCursorChange",this.k);this.data.attachEvent("onStoreUpdated",dhx.bind(function(a,b,c){a&&a==this.getCursor()&&c!="paint"&&this.k()},this));this.data.attachEvent("onClearAll",dhx.bind(function(){this.h=null},this));this.data.attachEvent("onIdChange",dhx.bind(function(a,b){if(this.h==a)this.h=b},this))},setCursor:function(a){if(!(a==
this.h||a!==null&&!this.item(a)))this.callEvent("onBeforeCursorChange",[this.h]),this.h=a,this.callEvent("onAfterCursorChange",[a])},getCursor:function(){return this.h},J:function(a,b){var c=this.item(this.getCursor())||this.a.defaultData||null;this.S(a,b,c)}};if(!dhx.ui)dhx.ui={};if(!dhx.ui.views)dhx.ui.views={},dhx.ui.get=function(a){return a.a?a:dhx.ui.views[a]};dhtmlXDataStore=function(a){var b=new dhx.DataCollection(a),c="_dp_init";b[c]=function(a){var b="_methods";a[b]=["dummy","dummy","changeId","dummy"];this.data.Da={add:"inserted",update:"updated","delete":"deleted"};this.data.attachEvent("onStoreUpdated",function(b,c,e){b&&!a.ea&&a.setUpdated(b,!0,this.Da[e])});b="_getRowData";a[b]=function(a){var b=this.obj.data.item(a),c={id:a,"!nativeeditor_status":this.obj.getUserData(a)};if(b)for(var d in b)d.indexOf("_")!==0&&(c[d]=b[d]);return c};this.changeId=
function(b,c){this.data.changeId(b,c);a.ea=!0;this.data.callEvent("onStoreUpdated",[c,this.item(c),"update"]);a.ea=!1};b="_clearUpdateFlag";a[b]=function(){};this.ia={}};b.dummy=function(){};b.setUserData=function(a,b,c){this.ia[a]=c};b.getUserData=function(a){return this.ia[a]};b.dataFeed=function(a){this.define("dataFeed",a)};dhx.extend(b,dhx.BindSource);return b};if(window.dhtmlXDataView)dhtmlXDataView.prototype.b=function(){this.isVisible=function(){return!this.data.order.length&&!this.data.c&&!this.a.dataFeed?!1:!0};var a="_settings";this.a=this.a||this[a];if(!this.a.id)this.a.id=dhx.uid();this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this.a.id]=this};if(window.dhtmlXChart)dhtmlXChart.prototype.b=function(){this.isVisible=function(){return!this.data.order.length&&!this.data.Qa&&!this.a.dataFeed?!1:!0};var a="_settings";this.a=this.a||this[a];if(!this.a.id)this.a.id=dhx.uid();this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this.a.id]=this};dhx.BaseBind.unsync=function(a){return dhx.BaseBind.g.call(this,a)};dhx.BaseBind.unbind=function(a){return dhx.BaseBind.g.call(this,a)};dhx.BaseBind.legacyBind=function(){return dhx.BaseBind.bind.apply(this,arguments)};dhx.BaseBind.legacySync=function(a,b){this.b&&this.b();a.b&&a.b();this.attachEvent("onAfterEditStop",function(a){this.save(a);return!0});this.attachEvent("onDataRequest",function(b,d){for(var e=b;e<b+d;e++)if(!a.data.order[e])return a.loadNext(d,b),!1});this.save=function(b){b||(b=this.getCursor());var d=this.item(b),e=a.item(b),f;for(f in d)f.indexOf("$")!==0&&(e[f]=d[f]);a.refresh(b)};return a&&a.name=="DataCollection"?a.data.sync.apply(this.data,arguments):this.data.sync.apply(this.data,arguments)};if(window.dhtmlXForm)dhtmlXForm.prototype.bind=function(a){dhx.BaseBind.bind.apply(this,arguments);a.getBindData(this.a.id)},dhtmlXForm.prototype.unbind=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXForm.prototype.b=function(){if(dhx.isUndefined(this.a))this.a={id:dhx.uid(),dataFeed:this.j},dhx.ui.views[this.a.id]=this},dhtmlXForm.prototype.z=function(a){if(!this.a.dataFeed||this.N||!a)return!0;var b=this.a.dataFeed;if(typeof b=="function")return b.call(this,a.id||a,a);b=b+(b.indexOf("?")==-1?"?":
"&")+"action=get&id="+encodeURIComponent(a.id||a);this.load(b);return!1},dhtmlXForm.prototype.setValues=dhtmlXForm.prototype.setFormData,dhtmlXForm.prototype.getValues=function(){return this.getFormData(!1,!0)},dhtmlXForm.prototype.dataFeed=function(a){this.a?this.a.dataFeed=a:this.j=a},dhtmlXForm.prototype.refresh=dhtmlXForm.prototype.isVisible=function(){return!0};if(window.scheduler){if(!window.Scheduler)window.Scheduler={};Scheduler.$syncFactory=function(a){a.sync=function(b,c){this.b&&this.b();b.b&&b.b();var d="_process_loading",e=function(){a.clearAll();for(var e=b.data.order,g=b.data.pull,h=[],i=0;i<e.length;i++)h[i]=c&&c.copy?dhx.clone(g[e[i]]):g[e[i]];a[d](h)};this.save=function(a){a||(a=this.getCursor());var c=this.item(a),d=b.item(a);this.callEvent("onStoreSave",[a,c,d])&&(dhx.extend(b.item(a),c,!0),b.update(a))};this.item=function(a){return this.getEvent(a)};this.w=[b.data.attachEvent("onStoreUpdated",function(){e.call(this)}),b.data.attachEvent("onIdChange",function(a,b){combo.changeOptionId(a,b)})];this.attachEvent("onEventChanged",function(a){this.save(a)});this.attachEvent("onEventAdded",function(a,c){b.data.pull[a]||b.add(c)});this.attachEvent("onEventDeleted",function(a){b.data.pull[a]&&b.remove(a)});e()};a.unsync=function(a){dhx.BaseBind.g.call(this,a)};a.b=function(){if(!this.a)this.a={id:dhx.uid()}}};Scheduler.$syncFactory(window.scheduler)}
if(window.dhtmlXCombo)dhtmlXCombo.prototype.bind=function(){dhx.BaseBind.bind.apply(this,arguments)},dhtmlXCombo.unbind=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXCombo.unsync=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXCombo.prototype.dataFeed=function(a){this.a?this.a.dataFeed=a:this.j=a},dhtmlXCombo.prototype.sync=function(a){this.b&&this.b();a.b&&a.b();var b=this,c=function(){b.clearAll();b.addOption(this.serialize())};this.w=[a.data.attachEvent("onStoreUpdated",function(){c.call(this)}),
a.data.attachEvent("onIdChange",function(a,c){b.changeOptionId(a,c)})];c.call(a)},dhtmlXCombo.prototype.b=function(){if(dhx.isUndefined(this.a))this.a={id:dhx.uid(),dataFeed:this.j},dhx.ui.views[this.a.id]=this,this.data={silent:dhx.bind(function(a){a.call(this)},this)},dhtmlxEventable(this.data),this.attachEvent("onChange",function(){this.callEvent("onSelectChange",[this.getSelectedValue()])}),this.attachEvent("onXLE",function(){this.callEvent("onBindRequest",[])})},dhtmlXCombo.prototype.item=function(){return this.Sa},
dhtmlXCombo.prototype.getSelected=function(){return this.getSelectedValue()},dhtmlXCombo.prototype.isVisible=function(){return!this.optionsArr.length&&!this.a.dataFeed?!1:!0},dhtmlXCombo.prototype.refresh=function(){this.render(!0)},dhtmlXCombo.prototype.filter=function(){alert("not implemented")};if(window.dhtmlXGridObject)dhtmlXGridObject.prototype.bind=function(a,b,c){dhx.BaseBind.bind.apply(this,arguments)},dhtmlXGridObject.prototype.unbind=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXGridObject.prototype.unsync=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXGridObject.prototype.dataFeed=function(a){this.a?this.a.dataFeed=a:this.j=a},dhtmlXGridObject.prototype.sync=function(a,b){this.b&&this.b();a.b&&a.b();var c=this,d="_parsing",e="_parser",f="_locator",g="_process_store_row",h="_get_store_data";this.save=function(b){b||(b=this.getCursor());dhx.extend(a.item(b),this.item(b),!0);a.update(b)};var i=function(){var a=0;c.B?(a=c.B,c.B=!1):c.clearAll();var b=this.dataCount();if(b){c[d]=!0;for(var i=a;i<b;i++){var k=this.order[i];if(k&&(!a||!c.rowsBuffer[i]))c.rowsBuffer[i]={idd:k,data:this.pull[k]},c.rowsBuffer[i][e]=c[g],c.rowsBuffer[i][f]=c[h],c.rowsAr[k]=this.pull[k]}if(!c.rowsBuffer[b-1])c.rowsBuffer[b-1]=dhtmlx.undefined,c.xmlFileUrl=c.xmlFileUrl||!0;c.pagingOn?c.changePage():c.Ta&&c.Oa?c.Ua():
(c.render_dataset(),c.callEvent("onXLE",[]));c[d]=!1}};this.w=[a.data.attachEvent("onStoreUpdated",function(a,b,d){d=="delete"?(c.deleteRow(a),c.data.callEvent("onStoreUpdated",[a,b,d])):d=="update"?(c.callEvent("onSyncUpdate",[b,d]),c.update(a,b),c.data.callEvent("onStoreUpdated",[a,b,d])):d=="add"?(c.callEvent("onSyncUpdate",[b,d]),c.add(a,b,this.indexById(a)),c.data.callEvent("onStoreUpdated",[a,b,d])):i.call(this)}),a.data.attachEvent("onStoreLoad",function(b,d){c.xmlFileUrl=a.data.url;c.B=b.getInfo(d).m}),
a.data.attachEvent("onIdChange",function(a,b){c.changeRowId(a,b)})];c.attachEvent("onDynXLS",function(b,d){for(var e=b;e<b+d;e++)if(!a.data.order[e])return a.loadNext(d,b),!1;c.B=b;i.call(a.data)});i.call(a.data);c.attachEvent("onEditCell",function(a,b){a==2&&this.save(b);return!0});c.attachEvent("onClearAll",function(){var a="_f_rowsBuffer";this[a]=null});b&&b.sort&&c.attachEvent("onBeforeSorting",function(b,d,e){if(d=="connector")return!1;var f=this.getColumnId(b);a.sort("#"+f+"#",e=="asc"?"asc":
"desc",d=="int"?d:"string");c.setSortImgState(!0,b,e);return!1});if(b&&b.filter)c.attachEvent("onFilterStart",function(b,d){var e="_con_f_used";if(c[e]&&c[e].length)return!1;a.data.silent(function(){a.filter();for(var e=0;e<b.length;e++)if(d[e]!=""){var f=c.getColumnId(b[e]);a.filter("#"+f+"#",d[e],e!=0)}});a.refresh();return!1}),c.collectValues=function(b){var c=this.getColumnId(b);return function(a){var b=[],c={};this.data.each(function(d){var e=d[a];c[e]||(c[e]=!0,b.push(e))});return b}.call(a,
c)};b&&b.select&&c.attachEvent("onRowSelect",function(b){a.setCursor(b)});c.clearAndLoad=function(b){a.clearAll();a.load(b)}},dhtmlXGridObject.prototype.b=function(){if(dhx.isUndefined(this.a)){this.a={id:dhx.uid(),dataFeed:this.j};dhx.ui.views[this.a.id]=this;this.data={silent:dhx.bind(function(a){a.call(this)},this)};dhtmlxEventable(this.data);for(var a="_cCount",b=0;b<this[a];b++)this.columnIds[b]||(this.columnIds[b]="cell"+b);this.attachEvent("onSelectStateChanged",function(a){this.callEvent("onSelectChange",
[a])});this.attachEvent("onSelectionCleared",function(){this.callEvent("onSelectChange",[null])});this.attachEvent("onEditCell",function(a,b){a===2&&this.getCursor&&b&&b==this.getCursor()&&this.k();return!0});this.attachEvent("onXLE",function(){this.callEvent("onBindRequest",[])})}},dhtmlXGridObject.prototype.item=function(a){if(a===null)return null;var b=this.getRowById(a);if(!b)return null;var c="_attrs",d=dhx.copy(b[c]);d.id=a;for(var e=this.getColumnsNum(),f=0;f<e;f++)d[this.columnIds[f]]=this.cells(a,
f).getValue();return d},dhtmlXGridObject.prototype.update=function(a,b){for(var c=0;c<this.columnIds.length;c++){var d=this.columnIds[c];dhx.isUndefined(b[d])||this.cells(a,c).setValue(b[d])}var e="_attrs",f=this.getRowById(a)[e];for(d in b)f[d]=b[d];this.callEvent("onBindUpdate",[a])},dhtmlXGridObject.prototype.add=function(a,b,c){for(var d=[],e=0;e<this.columnIds.length;e++){var f=this.columnIds[e];d[e]=dhx.isUndefined(b[f])?"":b[f]}this.addRow(a,d,c);var g="_attrs";this.getRowById(a)[g]=dhx.copy(b)},
dhtmlXGridObject.prototype.getSelected=function(){return this.getSelectedRowId()},dhtmlXGridObject.prototype.isVisible=function(){var a="_f_rowsBuffer";return!this.rowsBuffer.length&&!this[a]&&!this.a.dataFeed?!1:!0},dhtmlXGridObject.prototype.refresh=function(){this.render_dataset()},dhtmlXGridObject.prototype.filter=function(a,b){if(this.a.dataFeed){var c={};if(!a&&!b)return;if(typeof a=="function"){if(!b)return;a(b,c)}else dhx.isUndefined(a)?c=b:c[a]=b;this.clearAll();var d=this.a.dataFeed;if(typeof d==
"function")return d.call(this,b,c);var e=[],f;for(f in c)e.push("dhx_filter["+f+"]="+encodeURIComponent(c[f]));this.load(d+(d.indexOf("?")<0?"?":"&")+e.join("&"));return!1}if(b===null)return this.filterBy(0,function(){return!1});this.filterBy(0,function(c,d){return a.call(this,d,b)})};if(window.dhtmlXTreeObject)dhtmlXTreeObject.prototype.bind=function(){dhx.BaseBind.bind.apply(this,arguments)},dhtmlXTreeObject.prototype.unbind=function(a){dhx.BaseBind.g.call(this,a)},dhtmlXTreeObject.prototype.dataFeed=function(a){this.a?this.a.dataFeed=a:this.j=a},dhtmlXTreeObject.prototype.b=function(){if(dhx.isUndefined(this.a))this.a={id:dhx.uid(),dataFeed:this.j},dhx.ui.views[this.a.id]=this,this.data={silent:dhx.bind(function(a){a.call(this)},this)},dhtmlxEventable(this.data),this.attachEvent("onSelect",
function(a){this.callEvent("onSelectChange",[a])}),this.attachEvent("onEdit",function(a,b){a===2&&b&&b==this.getCursor()&&this.k();return!0})},dhtmlXTreeObject.prototype.item=function(a){return a===null?null:{id:a,text:this.getItemText(a)}},dhtmlXTreeObject.prototype.getSelected=function(){return this.getSelectedItemId()},dhtmlXTreeObject.prototype.isVisible=function(){return!0},dhtmlXTreeObject.prototype.refresh=function(){},dhtmlXTreeObject.prototype.filter=function(a,b){if(this.a.dataFeed){var c=
{};if(a||b){if(typeof a=="function"){if(!b)return;a(b,c)}else dhx.isUndefined(a)?c=b:c[a]=b;this.deleteChildItems(0);var d=this.a.dataFeed;if(typeof d=="function")return d.call(this,[data.id||data,data]);var e=[],f;for(f in c)e.push("dhx_filter["+f+"]="+encodeURIComponent(c[f]));this.loadXML(d+(d.indexOf("?")<0?"?":"&")+e.join("&"));return!1}}},dhtmlXTreeObject.prototype.update=function(a,b){dhx.isUndefined(b.text)||this.setItemText(a,b.text)};dhtmlx.skin='dhx_terrace';